summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthunderstruck47 <velislav.gerov.12@aberdeen.ac.uk>2017-07-26 17:49:43 +0300
committerthunderstruck47 <velislav.gerov.12@aberdeen.ac.uk>2017-07-26 17:55:40 +0300
commit845cf4ad5dc2e7ebe2284bb499cbe32136d6f0ab (patch)
tree4b5496f7e9cbe00e5970fb1ccc96093ee06158aa
parentb878d85dcbf3b57f940e7fe499d7b550f25f75da (diff)
downloadpython-json-patch-845cf4ad5dc2e7ebe2284bb499cbe32136d6f0ab.tar.gz
added a test case for issue #30
-rwxr-xr-xtests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index 51d9517..74266b6 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):