Skip to content

Commit

Permalink
Add test case for issue reported in #74
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankoegl committed Nov 25, 2017
1 parent d8c54d6 commit 04596b8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests.py
Expand Up @@ -388,6 +388,17 @@ def test_arrays_one_element_sequences(self):
res = jsonpatch.apply_patch(src, patch)
self.assertEqual(res, dst)

def test_list_in_dict(self):
""" Test patch creation with a list within a dict, as reported in #74
https://github.com/stefankoegl/python-json-patch/issues/74 """
old = {'key': [{'someNumber': 0, 'someArray': [1, 2, 3]}]}
new = {'key': [{'someNumber': 0, 'someArray': [1, 2, 3, 4]}]}
patch = jsonpatch.make_patch(old, new)
new_from_patch = jsonpatch.apply_patch(old, patch)
self.assertEqual(new, new_from_patch)


class OptimizationTests(unittest.TestCase):
def test_use_replace_instead_of_remove_add(self):
src = {'foo': [1, 2, 3]}
Expand Down

0 comments on commit 04596b8

Please sign in to comment.