Skip to content

Commit 04596b8

Browse files
committed
Add test case for issue reported in #74
1 parent d8c54d6 commit 04596b8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ def test_arrays_one_element_sequences(self):
388388
res = jsonpatch.apply_patch(src, patch)
389389
self.assertEqual(res, dst)
390390

391+
def test_list_in_dict(self):
392+
""" Test patch creation with a list within a dict, as reported in #74
393+
394+
https://github.com/stefankoegl/python-json-patch/issues/74 """
395+
old = {'key': [{'someNumber': 0, 'someArray': [1, 2, 3]}]}
396+
new = {'key': [{'someNumber': 0, 'someArray': [1, 2, 3, 4]}]}
397+
patch = jsonpatch.make_patch(old, new)
398+
new_from_patch = jsonpatch.apply_patch(old, patch)
399+
self.assertEqual(new, new_from_patch)
400+
401+
391402
class OptimizationTests(unittest.TestCase):
392403
def test_use_replace_instead_of_remove_add(self):
393404
src = {'foo': [1, 2, 3]}

0 commit comments

Comments
 (0)