Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-python-jsonschema-objects for
openSUSE:Factory checked in at 2023-07-18 22:09:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-jsonschema-objects (Old)
and /work/SRC/openSUSE:Factory/.python-python-jsonschema-objects.new.3193
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-jsonschema-objects"
Tue Jul 18 22:09:02 2023 rev:6 rq:1099288 version:0.4.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-python-jsonschema-objects/python-python-jsonschema-objects.changes
2022-08-27 13:21:22.465718293 +0200
+++
/work/SRC/openSUSE:Factory/.python-python-jsonschema-objects.new.3193/python-python-jsonschema-objects.changes
2023-07-18 22:09:34.255474214 +0200
@@ -1,0 +2,9 @@
+Tue Jul 11 13:18:57 UTC 2023 - Markéta Machová <[email protected]>
+
+- Update to 0.4.2
+ * Handle removed markdown version_info
+ * fix nested oneOf resolution with different schema types
+- Drop merged pso-markdown-version.patch
+- Pin jsonschema version to < 4.18, not supported yet
+
+-------------------------------------------------------------------
Old:
----
pso-markdown-version.patch
python_jsonschema_objects-0.4.1.tar.gz
New:
----
python_jsonschema_objects-0.4.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-python-jsonschema-objects.spec ++++++
--- /var/tmp/diff_new_pack.T2JphQ/_old 2023-07-18 22:09:34.871477658 +0200
+++ /var/tmp/diff_new_pack.T2JphQ/_new 2023-07-18 22:09:34.875477680 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-python-jsonschema-objects
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,29 +17,25 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-# python2-Markdown missing
-%define skip_python2 1
Name: python-python-jsonschema-objects
-Version: 0.4.1
+Version: 0.4.2
Release: 0
Summary: An object wrapper for JSON Schema definitions
License: MIT
URL: https://python-jsonschema-objects.readthedocs.org/
Source:
https://files.pythonhosted.org/packages/source/p/python_jsonschema_objects/python_jsonschema_objects-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM pso-markdown-version.patch
gh#cwacek/python-jsonschema-objects#230
-Patch0: pso-markdown-version.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Markdown >= 2.4
Requires: python-inflection >= 0.2
-Requires: python-jsonschema >= 2.3
Requires: python-six >= 1.5.2
+Requires: (python-jsonschema >= 2.3 with python-jsonschema < 4.18)
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Markdown >= 2.4}
BuildRequires: %{python_module inflection >= 0.2}
-BuildRequires: %{python_module jsonschema >= 2.3}
+BuildRequires: %{python_module jsonschema < 4.18}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six >= 1.5.2}
@@ -62,7 +58,7 @@
}
%check
-%pytest -k 'not test_validates'
+%pytest
%files %{python_files}
%doc README.md
++++++ python_jsonschema_objects-0.4.1.tar.gz ->
python_jsonschema_objects-0.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python_jsonschema_objects-0.4.1/PKG-INFO
new/python_jsonschema_objects-0.4.2/PKG-INFO
--- old/python_jsonschema_objects-0.4.1/PKG-INFO 2021-11-13
16:35:00.158926000 +0100
+++ new/python_jsonschema_objects-0.4.2/PKG-INFO 2023-05-15
03:14:48.112312800 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python_jsonschema_objects
-Version: 0.4.1
+Version: 0.4.2
Summary: An object wrapper for JSON Schema definitions
Home-page: http://python-jsonschema-objects.readthedocs.org/
Author: Chris Wacek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python_jsonschema_objects-0.4.1/docs/conf.py
new/python_jsonschema_objects-0.4.2/docs/conf.py
--- old/python_jsonschema_objects-0.4.1/docs/conf.py 2021-11-13
16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/docs/conf.py 2023-05-15
03:14:41.000000000 +0200
@@ -55,18 +55,18 @@
master_doc = "index"
# General information about the project.
-project = u"Python JSONSchema Objects"
-copyright = u"2016, Chris Wacek"
-author = u"Chris Wacek"
+project = "Python JSONSchema Objects"
+copyright = "2016, Chris Wacek"
+author = "Chris Wacek"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = u"0.0.18"
+version = "0.0.18"
# The full version, including alpha/beta/rc tags.
-release = u"0.0.18"
+release = "0.0.18"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -241,8 +241,8 @@
(
master_doc,
"PythonJSONSchemaObjects.tex",
- u"Python JSONSchema Objects Documentation",
- u"Chris Wacek",
+ "Python JSONSchema Objects Documentation",
+ "Chris Wacek",
"manual",
)
]
@@ -276,7 +276,7 @@
(
master_doc,
"pythonjsonschemaobjects",
- u"Python JSONSchema Objects Documentation",
+ "Python JSONSchema Objects Documentation",
[author],
1,
)
@@ -295,7 +295,7 @@
(
master_doc,
"PythonJSONSchemaObjects",
- u"Python JSONSchema Objects Documentation",
+ "Python JSONSchema Objects Documentation",
author,
"PythonJSONSchemaObjects",
"One line description of project.",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/__init__.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/__init__.py
--- old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/__init__.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/__init__.py
2023-05-15 03:14:41.000000000 +0200
@@ -159,7 +159,6 @@
if __name__ == "__main__":
-
validator = ObjectBuilder("../../protocol/json/schema.json")
from ._version import get_versions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/_version.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/_version.py
--- old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/_version.py
2021-11-13 16:35:00.158926000 +0100
+++ new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/_version.py
2023-05-15 03:14:48.112312800 +0200
@@ -11,8 +11,8 @@
{
"dirty": false,
"error": null,
- "full-revisionid": "ca06e7338d82e547267da8dfb5ba326d6d29ae99",
- "version": "0.4.1"
+ "full-revisionid": "51a29d2f19fc2ce18de99444616dde19dd42bd70",
+ "version": "0.4.2"
}
''' # END VERSION_JSON
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/classbuilder.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/classbuilder.py
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/classbuilder.py
2021-11-13 16:34:57.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/classbuilder.py
2023-05-15 03:14:41.000000000 +0200
@@ -347,7 +347,6 @@
propname = lambda x: self.__prop_names__[x]
missing = []
for x in self.__required__:
-
# Allow the null type
propinfo = self.propinfo(propname(x))
null_type = False
@@ -463,7 +462,7 @@
return pp
def resolve_type(self, ref, source):
- """ Return a resolved type for a URI, potentially constructing one if
necessary"""
+ """Return a resolved type for a URI, potentially constructing one if
necessary"""
uri = util.resolve_ref_uri(self.resolver.resolution_scope, ref)
if uri in self.resolved:
return self.resolved[uri]
@@ -488,7 +487,7 @@
return self.resolved[uri]
def construct(self, uri, *args, **kw):
- """ Wrapper to debug things """
+ """Wrapper to debug things"""
logger.debug(util.lazy_format("Constructing {0}", uri))
if ("override" not in kw or kw["override"] is False) and uri in
self.resolved:
logger.debug(util.lazy_format("Using existing {0}", uri))
@@ -501,7 +500,6 @@
return ret
def _construct(self, uri, clsdata, parent=(ProtocolBase,), **kw):
-
if "anyOf" in clsdata:
raise NotImplementedError("anyOf is not supported as bare
property")
@@ -531,7 +529,6 @@
return self.resolved[uri]
elif "$ref" in clsdata:
-
if "type" in clsdata and util.safe_issubclass(
clsdata["type"], (ProtocolBase, LiteralValue)
):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/descriptors.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/descriptors.py
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/descriptors.py
2021-11-13 16:34:57.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/descriptors.py
2023-05-15 03:14:41.000000000 +0200
@@ -3,7 +3,7 @@
class AttributeDescriptor(object):
- """ Provides property access for constructed class properties """
+ """Provides property access for constructed class properties"""
def __init__(self, prop, info, desc=""):
self.prop = prop
@@ -80,7 +80,13 @@
break
elif isinstance(typ, TypeProxy):
try:
- val = typ(**util.coerce_for_expansion(val))
+ # handle keyword expansion according to expected types
+ # using keywords like oneOf, value can be an object,
array or literal
+ val = util.coerce_for_expansion(val)
+ if isinstance(val, dict):
+ val = typ(**val)
+ else:
+ val = typ(val)
val.validate()
except Exception as e:
errors.append("Failed to coerce to '{0}':
{1}".format(typ, e))
@@ -119,7 +125,11 @@
val.validate()
elif isinstance(info["type"], TypeProxy):
- val = info["type"](val)
+ val = util.coerce_for_expansion(val)
+ if isinstance(val, dict):
+ val = info["type"](**val)
+ else:
+ val = info["type"](val)
elif isinstance(info["type"], TypeRef):
if not isinstance(val, info["type"].ref_class):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/literals.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/literals.py
--- old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/literals.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/literals.py
2023-05-15 03:14:41.000000000 +0200
@@ -24,7 +24,7 @@
@functools.total_ordering
class LiteralValue(object):
- """Docstring for LiteralValue """
+ """Docstring for LiteralValue"""
isLiteralClass = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/markdown_support.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/markdown_support.py
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/markdown_support.py
2021-11-13 16:34:57.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/markdown_support.py
2023-05-15 03:14:41.000000000 +0200
@@ -4,6 +4,11 @@
import re
import json
+try:
+ from markdown import __version_info__ as markdown_version_info
+except ImportError:
+ from markdown import version_info as markdown_version_info
+
def extract_code_blocks(filename):
with open(filename) as fin:
@@ -14,14 +19,9 @@
preprocessors = M.preprocessors
tree_processors = M.treeprocessors
- try:
- version_info = markdown.__version_info__
- except AttributeError:
- version_info = markdown.version_info
-
# Markdown 3.* stores the processors in a class that can be iterated
directly.
# Markdown 2.* stores them in a dict, so we have to pull out the values.
- if version_info[0] == 2:
+ if markdown_version_info[0] == 2:
# Note: `markdown.version_info` will be deprecated in favor of
# `markdown.__version_info__` in later versions of Markdown.
preprocessors = preprocessors.values()
@@ -42,10 +42,10 @@
class SpecialFencedCodeExtension(Extension):
def extendMarkdown(self, md, md_globals=None):
- """ Add FencedBlockPreprocessor to the Markdown instance. """
+ """Add FencedBlockPreprocessor to the Markdown instance."""
md.registerExtension(self)
- if markdown.version_info[0] >= 3:
+ if markdown_version_info[0] >= 3:
md.preprocessors.register(
SpecialFencePreprocessor(md), "fenced_code_block", 10
)
@@ -78,7 +78,6 @@
self.codehilite_conf = {}
def run(self, lines):
-
text = "\n".join(lines)
while True:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/pattern_properties.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/pattern_properties.py
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/pattern_properties.py
2021-11-13 16:34:57.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/pattern_properties.py
2023-05-15 03:14:41.000000000 +0200
@@ -71,6 +71,14 @@
):
return typ(val)
+ if isinstance(typ, cb.TypeProxy):
+ val = util.coerce_for_expansion(val)
+ if isinstance(val, dict):
+ val = typ(**val)
+ else:
+ val = typ(val)
+ return val
+
raise validators.ValidationError(
"additionalProperty type {0} was neither a literal "
"nor a schema wrapper: {1}".format(typ, val)
@@ -87,7 +95,6 @@
return self._make_type(p.schema_type, val)
if self._additional_type is True:
-
valtype = [
k
for k, t in validators.SCHEMA_TYPE_MAPPING
@@ -96,7 +103,7 @@
valtype = valtype[0]
return MakeLiteral(name, valtype, val)
- elif isinstance(self._additional_type, type):
+ elif isinstance(self._additional_type, (type, cb.TypeProxy)):
return self._make_type(self._additional_type, val)
raise validators.ValidationError(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/util.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/util.py
--- old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/util.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/util.py
2023-05-15 03:14:41.000000000 +0200
@@ -65,7 +65,7 @@
def propmerge(into, data_from):
- """ Merge JSON schema requirements into a dictionary """
+ """Merge JSON schema requirements into a dictionary"""
newprops = copy.deepcopy(into)
for prop, propval in six.iteritems(data_from):
@@ -206,7 +206,6 @@
def as_namespace(obj, names=None):
-
# functions
if isinstance(obj, type(as_namespace)):
obj = obj()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/wrapper_types.py
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/wrapper_types.py
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects/wrapper_types.py
2021-11-13 16:34:57.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects/wrapper_types.py
2023-05-15 03:14:41.000000000 +0200
@@ -118,7 +118,6 @@
return True
def validate_uniqueness(self):
-
if getattr(self, "uniqueItems", False) is True:
testset = set(repr(item) for item in self.data)
if len(testset) != len(self.data):
@@ -129,7 +128,6 @@
)
def validate_length(self):
-
if getattr(self, "minItems", None) is not None:
if len(self.data) < self.minItems:
raise ValidationError(
@@ -311,7 +309,7 @@
item_constraint = classbuilder.TypeProxy(type_array)
elif isdict and item_constraint.get("type") == "object":
- """ We need to create a ProtocolBase object for this
anonymous definition"""
+ """We need to create a ProtocolBase object for this
anonymous definition"""
uri = "{0}_{1}".format(name, "<anonymous_list_type>")
item_constraint = klassbuilder.construct(uri,
item_constraint)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/PKG-INFO
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects.egg-info/PKG-INFO
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/PKG-INFO
2021-11-13 16:35:00.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects.egg-info/PKG-INFO
2023-05-15 03:14:47.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-jsonschema-objects
-Version: 0.4.1
+Version: 0.4.2
Summary: An object wrapper for JSON Schema definitions
Home-page: http://python-jsonschema-objects.readthedocs.org/
Author: Chris Wacek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/SOURCES.txt
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects.egg-info/SOURCES.txt
---
old/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/SOURCES.txt
2021-11-13 16:35:00.000000000 +0100
+++
new/python_jsonschema_objects-0.4.2/python_jsonschema_objects.egg-info/SOURCES.txt
2023-05-15 03:14:47.000000000 +0200
@@ -51,6 +51,7 @@
test/test_regression_208.py
test/test_regression_213.py
test/test_regression_214.py
+test/test_regression_232.py
test/test_regression_49.py
test/test_regression_8.py
test/test_regression_87.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_array_validation.py
new/python_jsonschema_objects-0.4.2/test/test_array_validation.py
--- old/python_jsonschema_objects-0.4.1/test/test_array_validation.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_array_validation.py
2023-05-15 03:14:41.000000000 +0200
@@ -55,7 +55,6 @@
def test_array_length_validates(markdown_examples):
-
builder = pjo.ObjectBuilder(
markdown_examples["Example Schema"], resolved=markdown_examples
)
@@ -70,7 +69,6 @@
def test_minitems(arrayClass):
-
arrayClass.min = ["1"]
arrayClass.min.append("2")
@@ -79,7 +77,6 @@
def test_maxitems(arrayClass):
-
arrayClass.max = []
arrayClass.max.append("2")
@@ -95,7 +92,6 @@
def test_unique(arrayClass):
-
arrayClass.unique = ["hi", "there"]
with pytest.raises(pjo.ValidationError):
arrayClass.unique.append("hi")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_circular_references.py
new/python_jsonschema_objects-0.4.2/test/test_circular_references.py
--- old/python_jsonschema_objects-0.4.1/test/test_circular_references.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_circular_references.py
2023-05-15 03:14:41.000000000 +0200
@@ -3,7 +3,6 @@
def test_circular_references(markdown_examples):
-
builder = pjo.ObjectBuilder(markdown_examples["Circular References"])
klasses = builder.build_classes()
a = klasses.A()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_feature_177.py
new/python_jsonschema_objects-0.4.2/test/test_feature_177.py
--- old/python_jsonschema_objects-0.4.1/test/test_feature_177.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_feature_177.py
2023-05-15 03:14:41.000000000 +0200
@@ -5,7 +5,6 @@
@pytest.fixture
def classes():
-
schema = {
"title": "Config",
"type": "object",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_nested_arrays.py
new/python_jsonschema_objects-0.4.2/test/test_nested_arrays.py
--- old/python_jsonschema_objects-0.4.1/test/test_nested_arrays.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_nested_arrays.py
2023-05-15 03:14:41.000000000 +0200
@@ -9,12 +9,14 @@
@pytest.fixture
def nested_arrays():
return {
+ "$schema": "http://json-schema.org/draft-04/schema#",
"title": "example",
"properties": {
"foo": {
"type": "array",
"items": {
"type": "array",
+ # FIXME: not supported anymore in
https://json-schema.org/draft/2020-12
"items": [{"type": "number"}, {"type": "number"}],
},
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_pattern_properties.py
new/python_jsonschema_objects-0.4.2/test/test_pattern_properties.py
--- old/python_jsonschema_objects-0.4.1/test/test_pattern_properties.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_pattern_properties.py
2023-05-15 03:14:41.000000000 +0200
@@ -53,7 +53,6 @@
],
)
def test_pattern_properties_work(base_schema, permit_addl, property, value,
is_error):
-
base_schema["additionalProperties"] = permit_addl
builder = pjo.ObjectBuilder(base_schema)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python_jsonschema_objects-0.4.1/test/test_pytest.py
new/python_jsonschema_objects-0.4.2/test/test_pytest.py
--- old/python_jsonschema_objects-0.4.1/test/test_pytest.py 2021-11-13
16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_pytest.py 2023-05-15
03:14:41.000000000 +0200
@@ -221,7 +221,6 @@
"json_object", ['{"MyData": "an address"}', '{"MyData": "1234"}']
)
def test_oneOf_validates_against_any_valid(oneOf, json_object):
-
oneOf.from_json(json_object)
@@ -243,7 +242,6 @@
['{"MyAddress": "an address"}', '{"firstName": "John", "lastName":
"Winnebago"}'],
)
def test_oneOfBare_validates_against_any_valid(oneOfBare, json_object):
-
oneOfBare.from_json(json_object)
@@ -277,7 +275,6 @@
def test_still_raises_when_accessing_undefined_attrs(Person):
-
person = Person()
person.firstName = "James"
@@ -306,7 +303,6 @@
def test_additional_props_disallowed_explicitly(Other):
-
other = Other()
with pytest.raises(pjs.ValidationError):
other.randomAttribute = 4
@@ -467,7 +463,6 @@
],
)
def test_dictionary_transformation(Person, pdict):
-
person = Person(**pdict)
assert person.as_dict() == pdict
@@ -531,7 +526,6 @@
def test_justareference_example(markdown_examples):
-
builder = pjs.ObjectBuilder(
markdown_examples["Just a Reference"], resolved=markdown_examples
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_regression_143.py
new/python_jsonschema_objects-0.4.2/test/test_regression_143.py
--- old/python_jsonschema_objects-0.4.1/test/test_regression_143.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_regression_143.py
2023-05-15 03:14:41.000000000 +0200
@@ -44,7 +44,7 @@
def test_strict_validation(mocker):
- """ Validate that when specified as strict, validation still occurs on
every change"""
+ """Validate that when specified as strict, validation still occurs on
every change"""
schema = {
"title": "Example Schema",
"type": "object",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_regression_232.py
new/python_jsonschema_objects-0.4.2/test/test_regression_232.py
--- old/python_jsonschema_objects-0.4.1/test/test_regression_232.py
1970-01-01 01:00:00.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_regression_232.py
2023-05-15 03:14:41.000000000 +0200
@@ -0,0 +1,129 @@
+import jsonschema
+import pytest
+import python_jsonschema_objects as pjo
+
+schema = {
+ "$schema": "http://json-schema.org/draft-07/schema",
+ "title": "myschema",
+ "type": "object",
+ "definitions": {
+ "RefObject": {
+ "title": "Ref Object",
+ "properties": {"location": {"$ref": "#/definitions/Location"}},
+ },
+ "MapObject": {
+ "title": "Map Object",
+ "additionalProperties": {"$ref": "#/definitions/Location"},
+ },
+ "MainObject": {
+ "title": "Main Object",
+ "additionalProperties": False,
+ "type": "object",
+ "properties": {
+ "location": {
+ "title": "location",
+ "oneOf": [
+ {"$ref": "#/definitions/UNIQUE_STRING"},
+ {"$ref": "#/definitions/Location"},
+ ],
+ }
+ },
+ },
+ "Location": {
+ "title": "Location",
+ "description": "A Location represents a span on a specific
sequence.",
+ "oneOf": [
+ {"$ref": "#/definitions/LocationIdentifier"},
+ {"$ref": "#/definitions/LocationTyped"},
+ ],
+ },
+ "LocationIdentifier": {
+ "type": "integer",
+ "minimum": 1,
+ },
+ "LocationTyped": {
+ "additionalProperties": False,
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["Location"],
+ "default": "Location",
+ }
+ },
+ },
+ "UNIQUE_STRING": {
+ "additionalProperties": False,
+ "type": "string",
+ "pattern": "^\\w[^:]*:.+$",
+ },
+ },
+}
+
+
[email protected]
+def schema_json():
+ return schema
+
+
+def test_nested_oneof_with_different_types(schema_json):
+ builder = pjo.ObjectBuilder(schema_json)
+ ns = builder.build_classes()
+
+ resolver = jsonschema.RefResolver.from_schema(schema_json)
+ main_obj = schema_json["definitions"]["MainObject"]
+
+ test1 = {"location": 12345}
+ test2 = {"location": {"type": "Location"}}
+ test3 = {"location": "unique:12"}
+ jsonschema.validate(test1, main_obj, resolver=resolver)
+ jsonschema.validate(test2, main_obj, resolver=resolver)
+ jsonschema.validate(test3, main_obj, resolver=resolver)
+
+ obj1 = ns.MainObject(**test1)
+ obj2 = ns.MainObject(**test2)
+ obj3 = ns.MainObject(**test3)
+
+ assert obj1.location == 12345
+ assert obj2.location.type == "Location"
+ assert obj3.location == "unique:12"
+
+
+def test_nested_oneof_with_different_types_by_reference(schema_json):
+ builder = pjo.ObjectBuilder(schema_json)
+ ns = builder.build_classes()
+
+ resolver = jsonschema.RefResolver.from_schema(schema_json)
+ ref_obj = schema_json["definitions"]["RefObject"]
+
+ test1 = {"location": 12345}
+ test2 = {"location": {"type": "Location"}}
+ jsonschema.validate(test1, ref_obj, resolver=resolver)
+ jsonschema.validate(test2, ref_obj, resolver=resolver)
+
+ obj1 = ns.RefObject(**test1)
+ obj2 = ns.RefObject(**test2)
+
+ assert obj1.location == 12345
+ assert obj2.location.type == "Location"
+
+
+def
test_nested_oneof_with_different_types_in_additional_properties(schema_json):
+ builder = pjo.ObjectBuilder(schema_json)
+ ns = builder.build_classes()
+
+ resolver = jsonschema.RefResolver.from_schema(schema_json)
+ map_obj = schema_json["definitions"]["MapObject"]
+
+ x_prop_name = "location-id"
+
+ test1 = {x_prop_name: 12345}
+ test2 = {x_prop_name: {"type": "Location"}}
+ jsonschema.validate(test1, map_obj, resolver=resolver)
+ jsonschema.validate(test2, map_obj, resolver=resolver)
+
+ obj1 = ns.MapObject(**test1)
+ obj2 = ns.MapObject(**test2)
+
+ assert obj1[x_prop_name] == 12345
+ assert obj2[x_prop_name].type == "Location"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_regression_90.py
new/python_jsonschema_objects-0.4.2/test/test_regression_90.py
--- old/python_jsonschema_objects-0.4.1/test/test_regression_90.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_regression_90.py
2023-05-15 03:14:41.000000000 +0200
@@ -2,7 +2,6 @@
def test_null_type():
-
schema = {
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Example1",
@@ -16,7 +15,6 @@
def test_null_type_one_of():
-
schema = {
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Example1",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python_jsonschema_objects-0.4.1/test/test_util_pytest.py
new/python_jsonschema_objects-0.4.2/test/test_util_pytest.py
--- old/python_jsonschema_objects-0.4.1/test/test_util_pytest.py
2021-11-13 16:34:57.000000000 +0100
+++ new/python_jsonschema_objects-0.4.2/test/test_util_pytest.py
2023-05-15 03:14:41.000000000 +0200
@@ -61,7 +61,6 @@
def test_validate_arrays_with_mixed_types(Person):
-
validator = ArrayWrapper.create(
"test", item_constraint=[Person, {"type": "number"}]
)
@@ -75,7 +74,6 @@
def test_validate_arrays_nested():
-
validator = ArrayWrapper.create(
"test", item_constraint={"type": "array", "items": {"type": "integer"}}
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python_jsonschema_objects-0.4.1/tox.ini
new/python_jsonschema_objects-0.4.2/tox.ini
--- old/python_jsonschema_objects-0.4.1/tox.ini 2021-11-13 16:34:57.000000000
+0100
+++ new/python_jsonschema_objects-0.4.2/tox.ini 2023-05-15 03:14:41.000000000
+0200
@@ -1,11 +1,10 @@
[tox]
-envlist = py{35,36,37,38}-jsonschema{23,24,25,26,30}-markdown{2,3}
+envlist = py{36,37,38}-jsonschema{23,24,25,26,30}-markdown{2,3}
skip_missing_interpreters = true
[gh-actions]
python =
- 3.5: py35
3.6: py36
3.7: py37
3.8: py38
@@ -13,8 +12,8 @@
[testenv]
;install_command = pip install {opts} {packages}
-commands = coverage run {envbindir}/py.test
--doctest-glob='python_jsonschema_objects/*.md' {posargs}
- coverage xml --omit=*test* --include=*python_jsonschema_objects*
+commands = python -m coverage run {envbindir}/py.test
--doctest-glob='python_jsonschema_objects/*.md' {posargs}
+ python -m coverage xml --omit="*test*"
deps =
coverage
pytest