Skip to content

Commit 845cf4a

Browse files
committed
added a test case for issue stefankoegl#30
1 parent b878d85 commit 845cf4a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,15 @@ def test_json_patch(self):
376376
patch = jsonpatch.make_patch(old, new)
377377
new_from_patch = jsonpatch.apply_patch(old, patch)
378378
self.assertEqual(new, new_from_patch)
379-
379+
380+
def test_arrays_one_element_sequences(self):
381+
""" Tests the case of multiple common one element sequences inside an array """
382+
# see https://github.com/stefankoegl/python-json-patch/issues/30#issuecomment-155070128
383+
src = [1,2,3]
384+
dst = [3,1,4,2]
385+
patch = jsonpatch.make_patch(src, dst)
386+
res = jsonpatch.apply_patch(src, patch)
387+
self.assertEqual(res, dst)
380388

381389
class OptimizationTests(unittest.TestCase):
382390
def test_use_replace_instead_of_remove_add(self):

0 commit comments

Comments
 (0)