summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2017-09-10 12:44:37 +0200
committerGitHub <noreply@github.com>2017-09-10 12:44:37 +0200
commit7583258b618a4b651bb2fa41c12ff1c27de15d18 (patch)
tree38893919bbe11b680d468612f844fa8dc9da9dbc /tests.py
parentf0a4f51e32c77f9c774c26ef339dbd95cfa8ffa7 (diff)
parent845cf4ad5dc2e7ebe2284bb499cbe32136d6f0ab (diff)
downloadpython-json-patch-7583258b618a4b651bb2fa41c12ff1c27de15d18.tar.gz
Merge pull request #65 from thunderstruck47/master
fixing array diff bug (issue #30)
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index 6a8234f..78b06f5 100755
--- a/tests.py
+++ b/tests.py
@@ -376,7 +376,15 @@ class MakePatchTestCase(unittest.TestCase):
patch = jsonpatch.make_patch(old, new)
new_from_patch = jsonpatch.apply_patch(old, patch)
self.assertEqual(new, new_from_patch)
-
+
+ def test_arrays_one_element_sequences(self):
+ """ Tests the case of multiple common one element sequences inside an array """
+ # see https://github.com/stefankoegl/python-json-patch/issues/30#issuecomment-155070128
+ src = [1,2,3]
+ dst = [3,1,4,2]
+ patch = jsonpatch.make_patch(src, dst)
+ res = jsonpatch.apply_patch(src, patch)
+ self.assertEqual(res, dst)
class OptimizationTests(unittest.TestCase):
def test_use_replace_instead_of_remove_add(self):