Accepting request 936188 from home:glaubitz:branches:devel:languages:python
- Update to version 1.3.0 * Update README.rst * Add license to setup.py * Upating travis config to explicitly set ubuntu versions to use for each python version. * Fix long list diffing bug by converting recursive code to iterative. * Add failing test for list-diff recursion error bug - Refresh patches for new version * remove_nose.patch - Switch Source field to point to Github tarball URL * The tarball from PyPi does not contain the tests OBS-URL: https://build.opensuse.org/request/show/936188 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsondiff?expand=0&rev=17
This commit is contained in:
parent
00a6eee6d7
commit
0bcdfe2073
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:34941bc431d10aa15828afe1cbb644977a114e75eef6cc74fb58951312326303
|
|
||||||
size 7985
|
|
3
jsondiff-1.3.0.tar.gz
Normal file
3
jsondiff-1.3.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a899ebc34cad04561651a8b618df44004b5dbe35fadb83addd7f912faf4a43fb
|
||||||
|
size 15283
|
@ -1,3 +1,18 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Dec 7 09:32:07 UTC 2021 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||||
|
|
||||||
|
- Update to version 1.3.0
|
||||||
|
* Update README.rst
|
||||||
|
* Add license to setup.py
|
||||||
|
* Upating travis config to explicitly set ubuntu versions to use
|
||||||
|
for each python version.
|
||||||
|
* Fix long list diffing bug by converting recursive code to iterative.
|
||||||
|
* Add failing test for list-diff recursion error bug
|
||||||
|
- Refresh patches for new version
|
||||||
|
* remove_nose.patch
|
||||||
|
- Switch Source field to point to Github tarball URL
|
||||||
|
* The tarball from PyPi does not contain the tests
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Sep 13 17:39:27 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
Sun Sep 13 17:39:27 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-jsondiff
|
# spec file for package python-jsondiff
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020 SUSE LLC
|
# Copyright (c) 2021 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -18,12 +18,12 @@
|
|||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
Name: python-jsondiff
|
Name: python-jsondiff
|
||||||
Version: 1.2.0
|
Version: 1.3.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Module to diff JSON and JSON-like structures in Python
|
Summary: Module to diff JSON and JSON-like structures in Python
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/ZoomerAnalytics/jsondiff
|
URL: https://github.com/ZoomerAnalytics/jsondiff
|
||||||
Source: https://files.pythonhosted.org/packages/source/j/jsondiff/jsondiff-%{version}.tar.gz
|
Source: https://github.com/ZoomerAnalytics/jsondiff/archive/%{version}.tar.gz#/jsondiff-%{version}.tar.gz
|
||||||
# PATCH-FEATURE-UPSTREAM remove_nose.patch bsc#[0-9]+ mcepl@suse.com
|
# PATCH-FEATURE-UPSTREAM remove_nose.patch bsc#[0-9]+ mcepl@suse.com
|
||||||
# Replace nose-random plugin with ripped of version independent of nose.
|
# Replace nose-random plugin with ripped of version independent of nose.
|
||||||
Patch0: remove_nose.patch
|
Patch0: remove_nose.patch
|
||||||
|
@ -1,44 +1,10 @@
|
|||||||
--- /dev/null
|
diff -Nru jsondiff-1.3.0.orig/tests/__init__.py jsondiff-1.3.0/tests/__init__.py
|
||||||
+++ b/tests/_random.py
|
--- jsondiff-1.3.0.orig/tests/__init__.py 2021-04-19 21:51:14.000000000 +0200
|
||||||
@@ -0,0 +1,33 @@
|
+++ jsondiff-1.3.0/tests/__init__.py 2021-12-07 10:25:30.252455974 +0100
|
||||||
+import sys
|
@@ -1,130 +1,15 @@
|
||||||
+from random import Random
|
import sys
|
||||||
+
|
|
||||||
+PY3 = (sys.version_info[0] == 3)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def _generate_tag(n, rng):
|
|
||||||
+ return ''.join(rng.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
|
||||||
+ for _ in range(n))
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def randomize(n, scenario_generator, seed=12038728732):
|
|
||||||
+ def decorator(test):
|
|
||||||
+ def randomized_test(self):
|
|
||||||
+ rng_seed = Random(seed)
|
|
||||||
+ nseeds = n
|
|
||||||
+ # (rng_seed.getrandbits(32) for i in range(n))
|
|
||||||
+ seeds = (_generate_tag(12, rng_seed) for i in range(n))
|
|
||||||
+ for i, rseed in enumerate(seeds):
|
|
||||||
+ rng = Random(rseed)
|
|
||||||
+ scenario = scenario_generator(self, rng)
|
|
||||||
+ try:
|
|
||||||
+ test(self, scenario)
|
|
||||||
+ except Exception as e:
|
|
||||||
+ import sys
|
|
||||||
+ if PY3:
|
|
||||||
+ raise type(e).with_traceback(type(e)('%s with scenario %s (%i of %i)' %
|
|
||||||
+ (e.message, rseed, i+1, nseeds)), sys.exc_info()[2])
|
|
||||||
+ else:
|
|
||||||
+ raise (type(e), type(e)('%s with scenario %s (%i of %i)'
|
|
||||||
+ % (e.message, rseed, i+1, nseeds)), sys.exc_info()[2])
|
|
||||||
+ return randomized_test
|
|
||||||
+ return decorator
|
|
||||||
--- a/tests/__init__.py
|
|
||||||
+++ b/tests/__init__.py
|
|
||||||
@@ -1,115 +0,0 @@
|
|
||||||
-import unittest
|
-import unittest
|
||||||
-
|
|
||||||
-from jsondiff import diff, replace, add, discard, insert, delete, update, JsonDiffer
|
-from jsondiff import diff, replace, add, discard, insert, delete, update, JsonDiffer
|
||||||
-
|
-
|
||||||
-from .utils import generate_random_json, perturbate_json
|
-from .utils import generate_random_json, perturbate_json
|
||||||
@ -152,8 +118,73 @@
|
|||||||
- self.assertEqual(a, differ.unpatch(b, d))
|
- self.assertEqual(a, differ.unpatch(b, d))
|
||||||
- dm = differ.marshal(d)
|
- dm = differ.marshal(d)
|
||||||
- self.assertEqual(d, differ.unmarshal(dm))
|
- self.assertEqual(d, differ.unmarshal(dm))
|
||||||
--- /dev/null
|
-
|
||||||
+++ b/tests/test_jsondiff.py
|
- def test_long_arrays(self):
|
||||||
|
- size = 100
|
||||||
|
- a = [{'a': i, 'b': 2 * i} for i in range(1, size)]
|
||||||
|
- b = [{'a': i, 'b': 3 * i} for i in range(1, size)]
|
||||||
|
- r = sys.getrecursionlimit()
|
||||||
|
- sys.setrecursionlimit(size - 1)
|
||||||
|
-
|
||||||
|
- try:
|
||||||
|
- diff(a, b)
|
||||||
|
- except RecursionError:
|
||||||
|
- self.fail('cannot diff long arrays')
|
||||||
|
- finally:
|
||||||
|
- sys.setrecursionlimit(r)
|
||||||
|
+def test_long_arrays(self):
|
||||||
|
+ size = 100
|
||||||
|
+ a = [{'a': i, 'b': 2 * i} for i in range(1, size)]
|
||||||
|
+ b = [{'a': i, 'b': 3 * i} for i in range(1, size)]
|
||||||
|
+ r = sys.getrecursionlimit()
|
||||||
|
+ sys.setrecursionlimit(size - 1)
|
||||||
|
+
|
||||||
|
+ try:
|
||||||
|
+ diff(a, b)
|
||||||
|
+ except RecursionError:
|
||||||
|
+ self.fail('cannot diff long arrays')
|
||||||
|
+ finally:
|
||||||
|
+ sys.setrecursionlimit(r)
|
||||||
|
diff -Nru jsondiff-1.3.0.orig/tests/_random.py jsondiff-1.3.0/tests/_random.py
|
||||||
|
--- jsondiff-1.3.0.orig/tests/_random.py 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ jsondiff-1.3.0/tests/_random.py 2021-12-07 10:21:59.457195559 +0100
|
||||||
|
@@ -0,0 +1,33 @@
|
||||||
|
+import sys
|
||||||
|
+from random import Random
|
||||||
|
+
|
||||||
|
+PY3 = (sys.version_info[0] == 3)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def _generate_tag(n, rng):
|
||||||
|
+ return ''.join(rng.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
||||||
|
+ for _ in range(n))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def randomize(n, scenario_generator, seed=12038728732):
|
||||||
|
+ def decorator(test):
|
||||||
|
+ def randomized_test(self):
|
||||||
|
+ rng_seed = Random(seed)
|
||||||
|
+ nseeds = n
|
||||||
|
+ # (rng_seed.getrandbits(32) for i in range(n))
|
||||||
|
+ seeds = (_generate_tag(12, rng_seed) for i in range(n))
|
||||||
|
+ for i, rseed in enumerate(seeds):
|
||||||
|
+ rng = Random(rseed)
|
||||||
|
+ scenario = scenario_generator(self, rng)
|
||||||
|
+ try:
|
||||||
|
+ test(self, scenario)
|
||||||
|
+ except Exception as e:
|
||||||
|
+ import sys
|
||||||
|
+ if PY3:
|
||||||
|
+ raise type(e).with_traceback(type(e)('%s with scenario %s (%i of %i)' %
|
||||||
|
+ (e.message, rseed, i+1, nseeds)), sys.exc_info()[2])
|
||||||
|
+ else:
|
||||||
|
+ raise (type(e), type(e)('%s with scenario %s (%i of %i)'
|
||||||
|
+ % (e.message, rseed, i+1, nseeds)), sys.exc_info()[2])
|
||||||
|
+ return randomized_test
|
||||||
|
+ return decorator
|
||||||
|
diff -Nru jsondiff-1.3.0.orig/tests/test_jsondiff.py jsondiff-1.3.0/tests/test_jsondiff.py
|
||||||
|
--- jsondiff-1.3.0.orig/tests/test_jsondiff.py 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ jsondiff-1.3.0/tests/test_jsondiff.py 2021-12-07 10:21:59.457195559 +0100
|
||||||
@@ -0,0 +1,112 @@
|
@@ -0,0 +1,112 @@
|
||||||
+import unittest
|
+import unittest
|
||||||
+
|
+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user