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 2022-01-22 08:18:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-jsonschema-objects (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-jsonschema-objects.new.1938 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-jsonschema-objects"

Sat Jan 22 08:18:07 2022 rev:3 rq:947811 version:0.4.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-python-jsonschema-objects/python-python-jsonschema-objects.changes
        2020-03-21 00:03:09.345157038 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-python-jsonschema-objects.new.1938/python-python-jsonschema-objects.changes
      2022-01-22 08:18:41.754696845 +0100
@@ -1,0 +2,14 @@
+Fri Jan 21 02:56:29 UTC 2022 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 0.4.1:
+  * This release just incorporates the fix for #223
+  * Default values will now always serialize, even if the default value is 
null. Since this change could cause unexpected changes in serialized output the 
minor version has been bumped. Fixes #200
+  * Literals now properly support comparisons of all types (#213)
+  * oneOfs inside oneOfs (oneOf-ception?!) no longer fail to serialize (#214)
+  * #203 validatorSchemas passed in are now respected
+  * #208 oneOf roundtrip serializations work better
+  * #207 Another fix for abc deprecation
+  * Fixes import path for collections.abc to be compliant with Python 3.8 
[#197] (h/t @adriangay) 
+- Remove duplicate setuptools BuildRequires.
+
+-------------------------------------------------------------------

Old:
----
  python_jsonschema_objects-0.3.12.tar.gz

New:
----
  python_jsonschema_objects-0.4.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-jsonschema-objects.spec ++++++
--- /var/tmp/diff_new_pack.Wy7T0t/_old  2022-01-22 08:18:42.250693502 +0100
+++ /var/tmp/diff_new_pack.Wy7T0t/_new  2022-01-22 08:18:42.254693476 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-python-jsonschema-objects
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,14 +20,12 @@
 # python2-Markdown missing
 %define skip_python2 1
 Name:           python-python-jsonschema-objects
-Version:        0.3.12
+Version:        0.4.1
 Release:        0
 Summary:        An object wrapper for JSON Schema definitions
 License:        MIT
-Group:          Development/Languages/Python
 URL:            https://python-jsonschema-objects.readthedocs.org/
 Source:         
https://files.pythonhosted.org/packages/source/p/python_jsonschema_objects/python_jsonschema_objects-%{version}.tar.gz
-BuildRequires:  %{python_module setuptools >= 18.0.0}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros

++++++ python_jsonschema_objects-0.3.12.tar.gz -> 
python_jsonschema_objects-0.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python_jsonschema_objects-0.3.12/PKG-INFO 
new/python_jsonschema_objects-0.4.1/PKG-INFO
--- old/python_jsonschema_objects-0.3.12/PKG-INFO       2020-01-27 
04:29:55.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/PKG-INFO        2021-11-13 
16:35:00.158926000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: python_jsonschema_objects
-Version: 0.3.12
+Version: 0.4.1
 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.3.12/README.md 
new/python_jsonschema_objects-0.4.1/README.md
--- old/python_jsonschema_objects-0.3.12/README.md      2020-01-27 
04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/README.md       2021-11-13 
16:34:57.000000000 +0100
@@ -1,4 +1,4 @@
-[![Build 
Status](https://travis-ci.org/cwacek/python-jsonschema-objects.svg?branch=master)](https://travis-ci.org/cwacek/python-jsonschema-objects)
+[![Build](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml/badge.svg?branch=master)](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml)
 
 ## What
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/docs/Introduction.md 
new/python_jsonschema_objects-0.4.1/docs/Introduction.md
--- old/python_jsonschema_objects-0.3.12/docs/Introduction.md   2020-01-27 
04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/docs/Introduction.md    2021-11-13 
16:34:57.000000000 +0100
@@ -1,4 +1,4 @@
-[![Build 
Status](https://travis-ci.org/cwacek/python-jsonschema-objects.svg?branch=master)](https://travis-ci.org/cwacek/python-jsonschema-objects)
+[![Build](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml/badge.svg?branch=master)](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml)
 
 ## What
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/__init__.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/__init__.py
--- old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/__init__.py  
2020-01-27 04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/__init__.py   
2021-11-13 16:34:57.000000000 +0100
@@ -9,7 +9,6 @@
 import jsonschema
 import six
 from jsonschema import Draft4Validator
-from jsonschema.compat import iteritems
 
 import python_jsonschema_objects.classbuilder as classbuilder
 import python_jsonschema_objects.markdown_support
@@ -60,7 +59,7 @@
         )
 
         validatorClass = validatorClass or Draft4Validator
-        meta_validator = validatorClass(Draft4Validator.META_SCHEMA)
+        meta_validator = validatorClass(validatorClass.META_SCHEMA)
         meta_validator.validate(self.schema)
         self.validator = validatorClass(self.schema, resolver=self.resolver)
 
@@ -129,7 +128,7 @@
         """
         kw = {"strict": strict}
         builder = classbuilder.ClassBuilder(self.resolver)
-        for nm, defn in iteritems(self.schema.get("definitions", {})):
+        for nm, defn in six.iteritems(self.schema.get("definitions", {})):
             uri = python_jsonschema_objects.util.resolve_ref_uri(
                 self.resolver.resolution_scope, "#/definitions/" + nm
             )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/_version.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/_version.py
--- old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/_version.py  
2020-01-27 04:29:55.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/_version.py   
2021-11-13 16:35:00.158926000 +0100
@@ -11,8 +11,8 @@
 {
  "dirty": false,
  "error": null,
- "full-revisionid": "3f3cb9090c34016499b183cb14ca01d3cce4d46f",
- "version": "0.3.12"
+ "full-revisionid": "ca06e7338d82e547267da8dfb5ba326d6d29ae99",
+ "version": "0.4.1"
 }
 '''  # END VERSION_JSON
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/classbuilder.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/classbuilder.py
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/classbuilder.py  
    2020-01-27 04:29:38.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/classbuilder.py   
    2021-11-13 16:34:57.000000000 +0100
@@ -23,8 +23,8 @@
     long = int
 
 
-class ProtocolBase(collections.MutableMapping):
-    """ An instance of a class generated from the provided
+class ProtocolBase(collections.abc.MutableMapping):
+    """An instance of a class generated from the provided
     schema. All properties will be validated according to
     the definitions provided. However, whether or not all required
     properties have been provide will *not* be validated.
@@ -46,7 +46,7 @@
     __object_attr_list__ = set(["_properties", "_extended_properties"])
 
     def as_dict(self):
-        """ Return a dictionary containing the current values
+        """Return a dictionary containing the current values
         of the object.
 
         Returns:
@@ -104,7 +104,7 @@
 
     @classmethod
     def from_json(cls, jsonmsg):
-        """ Create an object directly from a JSON string.
+        """Create an object directly from a JSON string.
 
         Applies general validation after creating the
         object to check whether all required fields are
@@ -131,9 +131,9 @@
         return self.__class__(**self.as_dict())
 
     def __new__(cls, **props):
-        """ Overridden to support oneOf, where we need to
+        """Overridden to support oneOf, where we need to
         instantiate a different class depending on what
-        value we've seen """
+        value we've seen"""
         if getattr(cls, "__validation__", None) is None:
             new = super(ProtocolBase, cls).__new__
             if new is object.__new__:
@@ -196,6 +196,7 @@
                         "Setting value for '{0}' to {1}", prop, props[prop]
                     )
                 )
+                # Always set the property, even if None
                 if props[prop] is not None:
                     setattr(self, prop, props[prop])
             except validators.ValidationError as e:
@@ -298,7 +299,7 @@
         return enc.encode(self)
 
     def validate(self):
-        """ Applies all defined validation to the current
+        """Applies all defined validation to the current
         state of the object, and raises an error if
         they are not all met.
 
@@ -449,8 +450,8 @@
         self.under_construction = set()
 
     def expand_references(self, source_uri, iterable):
-        """ Give an iterable of jsonschema descriptors, expands any
-        of them that are $ref objects, and otherwise leaves them alone. 
+        """Give an iterable of jsonschema descriptors, expands any
+        of them that are $ref objects, and otherwise leaves them alone.
         """
         pp = []
         for elem in iterable:
@@ -505,7 +506,7 @@
             raise NotImplementedError("anyOf is not supported as bare 
property")
 
         elif "oneOf" in clsdata:
-            """ If this object itself has a 'oneOf' designation, 
+            """If this object itself has a 'oneOf' designation,
             then construct a TypeProxy.
             """
             klasses = self.construct_objects(clsdata["oneOf"], uri)
@@ -605,11 +606,11 @@
     def _build_literal(self, nm, clsdata):
         """@todo: Docstring for _build_literal
 
-      :nm: @todo
-      :clsdata: @todo
-      :returns: @todo
+        :nm: @todo
+        :clsdata: @todo
+        :returns: @todo
 
-      """
+        """
         cls = type(
             str(nm),
             tuple((LiteralValue,)),
@@ -649,7 +650,8 @@
             name_translation[prop] = prop.replace("@", "")
             prop = name_translation[prop]
 
-            if detail.get("default", None) is not None:
+            # Set default value, even if None
+            if "default" in detail:
                 defaults.add(prop)
 
             if detail.get("type", None) == "object":
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/descriptors.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/descriptors.py
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/descriptors.py   
    2020-01-27 04:29:38.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/descriptors.py    
    2021-11-13 16:34:57.000000000 +0100
@@ -44,38 +44,48 @@
                     type_checks.append(typ)
 
             for typ in type_checks:
-                if isinstance(val, typ):
+                if not isinstance(typ, TypeProxy) and isinstance(val, typ):
                     ok = True
                     break
                 elif hasattr(typ, "isLiteralClass"):
                     try:
                         validator = typ(val)
+                        validator.validate()
                     except Exception as e:
                         errors.append("Failed to coerce to '{0}': 
{1}".format(typ, e))
                         pass
                     else:
-                        validator.validate()
                         ok = True
                         break
                 elif util.safe_issubclass(typ, ProtocolBase):
                     # force conversion- thus the val rather than validator 
assignment
                     try:
                         val = typ(**util.coerce_for_expansion(val))
+                        val.validate()
                     except Exception as e:
                         errors.append("Failed to coerce to '{0}': 
{1}".format(typ, e))
                         pass
                     else:
-                        val.validate()
                         ok = True
                         break
                 elif util.safe_issubclass(typ, wrapper_types.ArrayWrapper):
                     try:
                         val = typ(val)
+                        val.validate()
                     except Exception as e:
                         errors.append("Failed to coerce to '{0}': 
{1}".format(typ, e))
                         pass
                     else:
+                        ok = True
+                        break
+                elif isinstance(typ, TypeProxy):
+                    try:
+                        val = typ(**util.coerce_for_expansion(val))
                         val.validate()
+                    except Exception as e:
+                        errors.append("Failed to coerce to '{0}': 
{1}".format(typ, e))
+                        pass
+                    else:
                         ok = True
                         break
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/examples/README.md
 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/examples/README.md
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/examples/README.md
   2020-01-27 04:29:38.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/examples/README.md
    2021-11-13 16:34:57.000000000 +0100
@@ -1,4 +1,4 @@
-[![Build 
Status](https://travis-ci.org/cwacek/python-jsonschema-objects.svg?branch=master)](https://travis-ci.org/cwacek/python-jsonschema-objects)
+[![Build](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml/badge.svg?branch=master)](https://github.com/cwacek/python-jsonschema-objects/actions/workflows/pythonpackage.yml)
 
 ## What
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/literals.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/literals.py
--- old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/literals.py  
2020-01-27 04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/literals.py   
2021-11-13 16:34:57.000000000 +0100
@@ -22,6 +22,7 @@
     return klass(value)
 
 
+@functools.total_ordering
 class LiteralValue(object):
     """Docstring for LiteralValue """
 
@@ -30,9 +31,9 @@
     def __init__(self, value, typ=None):
         """@todo: to be defined
 
-      :value: @todo
+        :value: @todo
 
-      """
+        """
         if isinstance(value, LiteralValue):
             self._value = value._value
         else:
@@ -84,12 +85,16 @@
                 validator(paramval, self._value, info)
 
     def __eq__(self, other):
+        if isinstance(other, LiteralValue):
+            return self._value == other._value
         return self._value == other
 
     def __hash__(self):
         return hash(self._value)
 
     def __lt__(self, other):
+        if isinstance(other, LiteralValue):
+            return self._value < other._value
         return self._value < other
 
     def __int__(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/util.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/util.py
--- old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/util.py      
2020-01-27 04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/util.py       
2021-11-13 16:34:57.000000000 +0100
@@ -116,7 +116,7 @@
 
 __all__ = ("Namespace", "as_namespace")
 
-from collections import Mapping, Sequence
+from collections.abc import Mapping, Sequence
 
 
 class _Dummy:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/wrapper_types.py 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/wrapper_types.py
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects/wrapper_types.py 
    2020-01-27 04:29:38.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects/wrapper_types.py  
    2021-11-13 16:34:57.000000000 +0100
@@ -10,8 +10,8 @@
 logger = logging.getLogger(__name__)
 
 
-class ArrayWrapper(collections.MutableSequence):
-    """ A wrapper for array-like structures.
+class ArrayWrapper(collections.abc.MutableSequence):
+    """A wrapper for array-like structures.
 
     This implements all of the array like behavior that one would want,
     with a dirty-tracking mechanism to avoid constant validation costs.
@@ -52,7 +52,7 @@
             return self.for_json() == other
 
     def __init__(self, ary):
-        """ Initialize a wrapper for the array
+        """Initialize a wrapper for the array
 
         Args:
             ary: (list-like, or ArrayWrapper)
@@ -64,7 +64,7 @@
         """ Holds a typed copy of the array """
         self._typed = None
 
-        if isinstance(ary, (list, tuple, collections.Sequence)):
+        if isinstance(ary, (list, tuple, collections.abc.Sequence)):
             self.data = ary
         else:
             raise TypeError("Invalid value given to array validator: 
{0}".format(ary))
@@ -147,7 +147,7 @@
                 )
 
     def validate_items(self):
-        """ Validates the items in the backing array, including
+        """Validates the items in the backing array, including
         performing type validation.
 
         Sets the _typed property and clears the dirty flag as a side effect
@@ -230,7 +230,7 @@
 
     @staticmethod
     def create(name, item_constraint=None, **addl_constraints):
-        """ Create an array validator based on the passed in constraints.
+        """Create an array validator based on the passed in constraints.
 
         If item_constraint is a tuple, it is assumed that tuple validation
         is being performed. If it is a class or dictionary, list validation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects.egg-info/PKG-INFO
 new/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/PKG-INFO
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects.egg-info/PKG-INFO
    2020-01-27 04:29:55.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/PKG-INFO 
    2021-11-13 16:35:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: python-jsonschema-objects
-Version: 0.3.12
+Version: 0.4.1
 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.3.12/python_jsonschema_objects.egg-info/SOURCES.txt
 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/SOURCES.txt
--- 
old/python_jsonschema_objects-0.3.12/python_jsonschema_objects.egg-info/SOURCES.txt
 2020-01-27 04:29:55.000000000 +0100
+++ 
new/python_jsonschema_objects-0.4.1/python_jsonschema_objects.egg-info/SOURCES.txt
  2021-11-13 16:35:00.000000000 +0100
@@ -33,6 +33,7 @@
 python_jsonschema_objects/examples/__init__.py
 test/test_array_validation.py
 test/test_circular_references.py
+test/test_default_values.py
 test/test_feature_151.py
 test/test_feature_177.py
 test/test_nested_arrays.py
@@ -47,6 +48,9 @@
 test/test_regression_165.py
 test/test_regression_17.py
 test/test_regression_185.py
+test/test_regression_208.py
+test/test_regression_213.py
+test/test_regression_214.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.3.12/test/test_default_values.py 
new/python_jsonschema_objects-0.4.1/test/test_default_values.py
--- old/python_jsonschema_objects-0.3.12/test/test_default_values.py    
1970-01-01 01:00:00.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_default_values.py     
2021-11-13 16:34:57.000000000 +0100
@@ -0,0 +1,65 @@
+import json
+import pytest
+import python_jsonschema_objects as pjo
+
+schema = """
+{
+  "$schema": "http://json-schema.org/draft-04/schema#";,
+  "title": "Default Test",
+  "type": "object",
+    "properties": {
+        "p1": {
+            "type": ["integer", "null"],
+            "default": 0
+        },
+        "p2": {
+            "type": ["integer", "null"],
+            "default": null
+        },
+        "p3": {
+            "type": ["integer", "null"]
+        }
+    }
+}
+"""
+
+
+@pytest.fixture
+def schema_json():
+    return json.loads(schema)
+
+
+@pytest.fixture
+def ns(schema_json):
+    builder = pjo.ObjectBuilder(schema_json)
+    ns = builder.build_classes()
+    return ns
+
+
+def test_defaults_serialize_for_nullable_types(ns):
+    thing1 = ns.DefaultTest()
+
+    assert thing1.as_dict() == {"p1": 0, "p2": None}
+
+
+def test_nullable_types_are_still_nullable(ns):
+    thing1 = ns.DefaultTest()
+
+    thing1.p1 = 10
+    thing1.validate()
+    assert thing1.as_dict() == {"p1": 10, "p2": None}
+
+    thing1.p1 = None
+    thing1.validate()
+    assert thing1.as_dict() == {"p1": 0, "p2": None}
+
+
+def test_null_types_without_defaults_do_not_serialize(ns):
+    thing1 = ns.DefaultTest()
+
+    thing1.p3 = 10
+    thing1.validate()
+    thing1.p1 = None
+    thing1.validate()
+
+    assert thing1.as_dict() == {"p1": 0, "p2": None, "p3": 10}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/test/test_pattern_properties.py 
new/python_jsonschema_objects-0.4.1/test/test_pattern_properties.py
--- old/python_jsonschema_objects-0.3.12/test/test_pattern_properties.py        
2020-01-27 04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_pattern_properties.py 
2021-11-13 16:34:57.000000000 +0100
@@ -18,7 +18,7 @@
 
 
 def test_standard_properties_take_precedence(base_schema):
-    """ foobar is a boolean, and it's a standard property,
+    """foobar is a boolean, and it's a standard property,
     so we expect it will validate properly as a boolean,
     not using the patternProperty that matches it.
     """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python_jsonschema_objects-0.3.12/test/test_pytest.py 
new/python_jsonschema_objects-0.4.1/test/test_pytest.py
--- old/python_jsonschema_objects-0.3.12/test/test_pytest.py    2020-01-27 
04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_pytest.py     2021-11-13 
16:34:57.000000000 +0100
@@ -35,8 +35,7 @@
 
 
 def test_schema_validation():
-    """ Test that the ObjectBuilder validates the schema itself.
-    """
+    """Test that the ObjectBuilder validates the schema itself."""
     schema = {
         "$schema": "http://json-schema.org/schema#";,
         "$id": "test",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/test/test_regression_208.py 
new/python_jsonschema_objects-0.4.1/test/test_regression_208.py
--- old/python_jsonschema_objects-0.3.12/test/test_regression_208.py    
1970-01-01 01:00:00.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_regression_208.py     
2021-11-13 16:34:57.000000000 +0100
@@ -0,0 +1,114 @@
+import json
+import pytest
+import python_jsonschema_objects as pjo
+
+schema = """
+{
+  "$schema": "http://json-schema.org/draft-04/schema#";,
+  "$id": "roundtrip.json",
+  "type": "object",
+  "properties":
+  {
+    "container": {"$ref": "#/definitions/config"}
+  },
+  "definitions": {
+    "config": {
+      "properties":{
+        "something": {
+          "allOf": [
+            {
+              "$ref": "#/definitions/params"
+            },
+            {
+              "properties":{
+                "parameters": {
+                  "oneOf": [
+                    {
+                      "$ref": "#/definitions/parametersA"
+                    },
+                    {
+                      "$ref": "#/definitions/parametersB"
+                    }
+                  ]
+                }
+              },
+              "required": ["parameters"]
+            }
+          ]
+        }
+      }
+    },
+    "params": {
+      "type": "object",
+      "properties": {
+        "param1": {
+          "type": "string"
+        },
+        "param2": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "param1",
+        "param2"
+      ]
+    },
+    "parametersA": {
+      "properties": {
+        "name": {
+          "type": "string"
+        },
+        "value": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "name",
+        "value"
+      ]
+    },
+    "parametersB": {
+      "properties": {
+        "something": {
+          "type": "string"
+        },
+        "another": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "something",
+        "another"
+      ]
+    }
+  }
+}
+"""
+
+
+@pytest.fixture
+def schema_json():
+    return json.loads(schema)
+
+
+def test_roundtrip_oneof_serializer(schema_json):
+    builder = pjo.ObjectBuilder(schema_json)
+    namespace = builder.build_classes()
+
+    data_config = """
+    {
+    "something": "a name",
+    "another": "a value"
+    }
+    """
+    paramsTypeB = namespace.Parametersb().from_json(data_config)
+    somethingInstance = namespace.Something(param1="toto", param2="tata")
+    somethingInstance.parameters = paramsTypeB
+
+    json_object = somethingInstance.serialize()
+    print(json_object)
+
+    aNewsomething = namespace.Something.from_json(json_object)
+
+    json_object2 = aNewsomething.serialize()
+    assert json_object == json_object2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/test/test_regression_213.py 
new/python_jsonschema_objects-0.4.1/test/test_regression_213.py
--- old/python_jsonschema_objects-0.3.12/test/test_regression_213.py    
1970-01-01 01:00:00.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_regression_213.py     
2021-11-13 16:34:57.000000000 +0100
@@ -0,0 +1,36 @@
+import json
+import pytest
+import python_jsonschema_objects as pjo
+
+schema = """
+{
+    "title":"whatever",
+    "properties": {
+        "test": {"type": "number"}
+    }
+}
+"""
+
+
+@pytest.fixture
+def schema_json():
+    return json.loads(schema)
+
+
+def test_literals_support_comparisons(schema_json):
+    builder = pjo.ObjectBuilder(schema_json)
+    ns = builder.build_classes()
+
+    thing1 = ns.Whatever()
+    thing2 = ns.Whatever()
+
+    thing1.test = 10
+    thing2.test = 12
+
+    assert thing1.test < thing2.test
+    assert thing1.test == thing1.test
+
+    thing2.test = 10
+
+    assert thing1.test <= thing2.test
+    assert thing1.test == thing2.test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python_jsonschema_objects-0.3.12/test/test_regression_214.py 
new/python_jsonschema_objects-0.4.1/test/test_regression_214.py
--- old/python_jsonschema_objects-0.3.12/test/test_regression_214.py    
1970-01-01 01:00:00.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/test/test_regression_214.py     
2021-11-13 16:34:57.000000000 +0100
@@ -0,0 +1,81 @@
+import json
+import pytest
+import python_jsonschema_objects as pjo
+
+schema = {
+    "$schema": "http://json-schema.org/draft-07/schema";,
+    "title": "myschema",
+    "type": "object",
+    "definitions": {
+        "MainObject": {
+            "title": "Main Object",
+            "additionalProperties": False,
+            "type": "object",
+            "properties": {
+                "location": {
+                    "title": "location",
+                    "type": ["object", "string"],
+                    "oneOf": [
+                        {"$ref": "#/definitions/UNIQUE_STRING"},
+                        {"$ref": "#/definitions/Location"},
+                    ],
+                }
+            },
+        },
+        "Location": {
+            "title": "Location",
+            "description": "A Location represents a span on a specific 
sequence.",
+            "type": "object",
+            "oneOf": [
+                {"$ref": "#/definitions/Location1"},
+                {"$ref": "#/definitions/Location2"},
+            ],
+            "discriminator": {"propertyName": "type"},
+        },
+        "Location1": {
+            "additionalProperties": False,
+            "type": "object",
+            "properties": {
+                "type": {
+                    "type": "string",
+                    "enum": ["Location1"],
+                    "default": "Location1",
+                }
+            },
+        },
+        "Location2": {
+            "additionalProperties": False,
+            "type": "object",
+            "properties": {
+                "type": {
+                    "type": "string",
+                    "enum": ["Location2"],
+                    "default": "Location2",
+                }
+            },
+        },
+        "UNIQUE_STRING": {
+            "additionalProperties": False,
+            "type": "string",
+            "pattern": "^\\w[^:]*:.+$",
+        },
+    },
+}
+
+
+@pytest.fixture
+def schema_json():
+    return schema
+
+
+def test_nested_oneofs_still_work(schema_json):
+    builder = pjo.ObjectBuilder(schema_json)
+    ns = builder.build_classes()
+
+    obj1 = ns.MainObject(**{"location": {"type": "Location1"}})
+    obj2 = ns.MainObject(**{"location": {"type": "Location2"}})
+    obj3 = ns.MainObject(**{"location": "unique:12"})
+
+    assert obj1.location.type == "Location1"
+    assert obj2.location.type == "Location2"
+    assert obj3.location == "unique:12"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python_jsonschema_objects-0.3.12/tox.ini 
new/python_jsonschema_objects-0.4.1/tox.ini
--- old/python_jsonschema_objects-0.3.12/tox.ini        2020-01-27 
04:29:38.000000000 +0100
+++ new/python_jsonschema_objects-0.4.1/tox.ini 2021-11-13 16:34:57.000000000 
+0100
@@ -1,8 +1,16 @@
 
 [tox]
-envlist = py{35,36,37}-jsonschema{23,24,25,26,30}-markdown{2,3}
+envlist = py{35,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
+
+
 [testenv]
 ;install_command = pip install {opts} {packages}
 commands = coverage run {envbindir}/py.test 
--doctest-glob='python_jsonschema_objects/*.md'  {posargs} 

Reply via email to