summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2017-11-25 19:15:59 +0100
committerStefan Kögl <stefan@skoegl.net>2017-11-25 19:15:59 +0100
commitae895f7ed9aa96e96d9d3ba402d3e2d0a11b0c8e (patch)
treef05287d5a5bb8ca178818d442d3aa3d45e00bad1
parent04596b810baf178ee3799c72c03bfe1990400418 (diff)
downloadpython-json-patch-ae895f7ed9aa96e96d9d3ba402d3e2d0a11b0c8e.tar.gz
Add test case for issue reported in #41
-rwxr-xr-xtests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index f238115..29a8ae9 100755
--- a/tests.py
+++ b/tests.py
@@ -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):