commit python-warlock for openSUSE:Factory
Hello community, here is the log from the commit of package python-warlock for openSUSE:Factory checked in at 2016-12-08 00:30:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-warlock (Old) and /work/SRC/openSUSE:Factory/.python-warlock.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-warlock" Changes: -------- --- /work/SRC/openSUSE:Factory/python-warlock/python-warlock.changes 2014-09-17 17:27:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-warlock.new/python-warlock.changes 2016-12-08 00:30:30.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Nov 15 12:40:31 UTC 2016 - dmueller@suse.com + +- update to 1.2.0 + +------------------------------------------------------------------- Old: ---- warlock-1.1.0.tar.gz New: ---- warlock-1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-warlock.spec ++++++ --- /var/tmp/diff_new_pack.wzoxlU/_old 2016-12-08 00:30:31.000000000 +0100 +++ /var/tmp/diff_new_pack.wzoxlU/_new 2016-12-08 00:30:31.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-warlock # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,13 @@ Name: python-warlock -Version: 1.1.0 +Version: 1.2.0 Release: 0 Summary: Python object model built on top of JSON schema License: Apache-2.0 Group: Development/Languages/Python Url: http://github.com/bcwaldon/warlock -Source: http://pypi.python.org/packages/source/w/warlock/warlock-%{version}.tar.gz +Source: https://pypi.io/packages/source/w/warlock/warlock-%{version}.tar.gz BuildRequires: python-devel BuildRequires: python-jsonpatch BuildRequires: python-jsonschema ++++++ warlock-1.1.0.tar.gz -> warlock-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/PKG-INFO new/warlock-1.2.0/PKG-INFO --- old/warlock-1.1.0/PKG-INFO 2013-11-19 16:08:08.000000000 +0100 +++ new/warlock-1.2.0/PKG-INFO 2015-10-12 19:09:45.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: warlock -Version: 1.1.0 +Version: 1.2.0 Summary: Python object model built on JSON schema and JSON patch. Home-page: http://github.com/bcwaldon/warlock Author: Brian Waldon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/setup.cfg new/warlock-1.2.0/setup.cfg --- old/warlock-1.1.0/setup.cfg 2013-11-19 16:08:08.000000000 +0100 +++ new/warlock-1.2.0/setup.cfg 2015-10-12 19:09:45.000000000 +0200 @@ -1,3 +1,6 @@ +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/setup.py new/warlock-1.2.0/setup.py --- old/warlock-1.1.0/setup.py 2013-11-19 16:04:21.000000000 +0100 +++ new/warlock-1.2.0/setup.py 2015-10-12 19:08:55.000000000 +0200 @@ -24,7 +24,7 @@ setuptools.setup( name='warlock', - version='1.1.0', + version='1.2.0', description='Python object model built on JSON schema and JSON patch.', author='Brian Waldon', author_email='bcwaldon@gmail.com', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/test/test_core.py new/warlock-1.2.0/test/test_core.py --- old/warlock-1.1.0/test/test_core.py 2013-11-19 16:00:43.000000000 +0100 +++ new/warlock-1.2.0/test/test_core.py 2015-10-12 18:48:26.000000000 +0200 @@ -15,6 +15,8 @@ import copy import unittest +import json + import six import warlock @@ -39,6 +41,15 @@ } +nameless_fixture = { + 'properties': { + 'name': {'type': 'string'}, + 'population': {'type': 'integer'}, + }, + 'additionalProperties': False, +} + + class TestCore(unittest.TestCase): def test_create_invalid_object(self): Country = warlock.model_factory(fixture) @@ -94,6 +105,19 @@ exc = warlock.InvalidOperation self.assertRaises(exc, sweden.update, {'population': 'N/A'}) self.assertRaises(exc, sweden.update, {'overloard': 'Bears'}) + + def test_naming(self): + Country = warlock.model_factory(fixture) + self.assertEqual(Country.__name__, 'Country') + + Country2 = warlock.model_factory(fixture, name='Country2') + self.assertEqual(Country2.__name__, 'Country2') + + nameless = warlock.model_factory(nameless_fixture) + self.assertEqual(nameless.__name__, 'Model') + + nameless2 = warlock.model_factory(nameless_fixture, name='Country3') + self.assertEqual(nameless2.__name__, 'Country3') def test_deepcopy(self): """Make sure we aren't leaking references.""" @@ -169,14 +193,17 @@ sweden = Country(name='Sweden', population=9379116) sweden['name'] = 'Finland' self.assertEqual( - sweden.patch, - '[{"path": "/name", "value": "Finland", "op": "replace"}]') + json.loads(sweden.patch), + json.loads( + '[{"path": "/name", "value": "Finland", "op": "replace"}]')) def test_patch_drop_attribute(self): Country = warlock.model_factory(fixture) sweden = Country(name='Sweden', population=9379116) del sweden['name'] - self.assertEqual(sweden.patch, '[{"path": "/name", "op": "remove"}]') + self.assertEqual( + json.loads(sweden.patch), + json.loads('[{"path": "/name", "op": "remove"}]')) def test_patch_reduce_operations(self): Country = warlock.model_factory(fixture) @@ -184,13 +211,15 @@ sweden['name'] = 'Finland' self.assertEqual( - sweden.patch, - '[{"path": "/name", "value": "Finland", "op": "replace"}]') + json.loads(sweden.patch), + json.loads( + '[{"path": "/name", "value": "Finland", "op": "replace"}]')) sweden['name'] = 'Norway' self.assertEqual( - sweden.patch, - '[{"path": "/name", "value": "Norway", "op": "replace"}]') + json.loads(sweden.patch), + json.loads( + '[{"path": "/name", "value": "Norway", "op": "replace"}]')) def test_patch_multiple_operations(self): Country = warlock.model_factory(fixture) @@ -198,7 +227,12 @@ sweden['name'] = 'Finland' sweden['population'] = 5387000 - self.assertEqual( - sweden.patch, + + self.assertEqual(len(json.loads(sweden.patch)), 2) + + patches = json.loads( '[{"path": "/name", "value": "Finland", "op": "replace"}, ' '{"path": "/population", "value": 5387000, "op": "replace"}]') + + for patch in json.loads(sweden.patch): + self.assertTrue(patch in patches) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/warlock/core.py new/warlock-1.2.0/warlock/core.py --- old/warlock-1.1.0/warlock/core.py 2013-11-19 16:00:43.000000000 +0100 +++ new/warlock-1.2.0/warlock/core.py 2015-10-12 18:48:26.000000000 +0200 @@ -19,10 +19,11 @@ from . import model -def model_factory(schema, base_class=model.Model): +def model_factory(schema, base_class=model.Model, name=None): """Generate a model class based on the provided JSON Schema :param schema: dict representing valid JSON schema + :param name: A name to give the class, if `name` is not in `schema` """ schema = copy.deepcopy(schema) @@ -31,5 +32,8 @@ self.__dict__['schema'] = schema base_class.__init__(self, *args, **kwargs) - Model.__name__ = str(schema['name']) + if name is not None: + Model.__name__ = name + elif 'name' in schema: + Model.__name__ = str(schema['name']) return Model diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/warlock.egg-info/PKG-INFO new/warlock-1.2.0/warlock.egg-info/PKG-INFO --- old/warlock-1.1.0/warlock.egg-info/PKG-INFO 2013-11-19 16:08:08.000000000 +0100 +++ new/warlock-1.2.0/warlock.egg-info/PKG-INFO 2015-10-12 19:09:45.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: warlock -Version: 1.1.0 +Version: 1.2.0 Summary: Python object model built on JSON schema and JSON patch. Home-page: http://github.com/bcwaldon/warlock Author: Brian Waldon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/warlock.egg-info/SOURCES.txt new/warlock-1.2.0/warlock.egg-info/SOURCES.txt --- old/warlock-1.1.0/warlock.egg-info/SOURCES.txt 2013-11-19 16:08:08.000000000 +0100 +++ new/warlock-1.2.0/warlock.egg-info/SOURCES.txt 2015-10-12 19:09:45.000000000 +0200 @@ -2,6 +2,7 @@ MANIFEST.in README.md requirements.txt +setup.cfg setup.py test/test_core.py warlock/__init__.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/warlock-1.1.0/warlock.egg-info/requires.txt new/warlock-1.2.0/warlock.egg-info/requires.txt --- old/warlock-1.1.0/warlock.egg-info/requires.txt 2013-11-19 16:08:08.000000000 +0100 +++ new/warlock-1.2.0/warlock.egg-info/requires.txt 2015-10-12 19:09:45.000000000 +0200 @@ -1,3 +1,3 @@ jsonschema>=0.7,<3 jsonpatch>=0.10,<2 -six \ No newline at end of file +six
participants (1)
-
root@hilbert.suse.de