diff options
author | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 19:15:59 +0100 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 19:15:59 +0100 |
commit | ae895f7ed9aa96e96d9d3ba402d3e2d0a11b0c8e (patch) | |
tree | f05287d5a5bb8ca178818d442d3aa3d45e00bad1 | |
parent | 04596b810baf178ee3799c72c03bfe1990400418 (diff) | |
download | python-json-patch-ae895f7ed9aa96e96d9d3ba402d3e2d0a11b0c8e.tar.gz |
Add test case for issue reported in #41
-rwxr-xr-x | tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -398,6 +398,16 @@ class MakePatchTestCase(unittest.TestCase): 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): |