diff options
author | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 19:13:39 +0100 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 19:13:39 +0100 |
commit | 04596b810baf178ee3799c72c03bfe1990400418 (patch) | |
tree | 1f38de363870ca88bba36f56488acee239414f00 | |
parent | d8c54d65a32fa8b56da0b130ea678f094ff381c3 (diff) | |
download | python-json-patch-04596b810baf178ee3799c72c03bfe1990400418.tar.gz |
Add test case for issue reported in #74
-rwxr-xr-x | tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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]} |