summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2017-11-25 19:13:39 +0100
committerStefan Kögl <stefan@skoegl.net>2017-11-25 19:13:39 +0100
commit04596b810baf178ee3799c72c03bfe1990400418 (patch)
tree1f38de363870ca88bba36f56488acee239414f00 /tests.py
parentd8c54d65a32fa8b56da0b130ea678f094ff381c3 (diff)
downloadpython-json-patch-04596b810baf178ee3799c72c03bfe1990400418.tar.gz
Add test case for issue reported in #74
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index cdb805f..f238115 100755
--- a/tests.py
+++ b/tests.py
@@ -388,6 +388,17 @@ class MakePatchTestCase(unittest.TestCase):
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]}