Skip to content

Commit

Permalink
Add test case for issue reported in #41
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankoegl committed Nov 25, 2017
1 parent 04596b8 commit ae895f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests.py
Expand Up @@ -398,6 +398,16 @@ def test_list_in_dict(self):
new_from_patch = jsonpatch.apply_patch(old, patch)
self.assertEqual(new, new_from_patch)

def test_nested(self):
""" Patch creation with nested dicts, as reported in #41
https://github.com/stefankoegl/python-json-patch/issues/41 """
old = {'school':{'names':['Kevin','Carl']}}
new = {'school':{'names':['Carl','Kate','Kevin','Jake']}}
patch = jsonpatch.JsonPatch.from_diff(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):
Expand Down

0 comments on commit ae895f7

Please sign in to comment.