summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jsonpatch.py2
-rwxr-xr-xtests.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index a08a761..7c8fa8f 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -31,7 +31,7 @@
#
"""Apply JSON-Patches according to
-http://tools.ietf.org/html/draft-pbryan-json-patch-04"""
+http://tools.ietf.org/html/draft-ietf-appsawg-json-patch-03"""
# Will be parsed by setup.py to determine package metadata
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
diff --git a/tests.py b/tests.py
index 8caec43..b922e77 100755
--- a/tests.py
+++ b/tests.py
@@ -133,6 +133,16 @@ class MakePatchTestCase(unittest.TestCase):
res = patch.apply(src)
self.assertEqual(res, dst)
+ def test_add_nested(self):
+ # see http://tools.ietf.org/html/draft-ietf-appsawg-json-patch-03#appendix-A.10
+ src = {"foo": "bar"}
+ patch_obj = [ { "add": "/child", "value": { "grandchild": { } } } ]
+ res = jsonpatch.apply_patch(src, patch_obj)
+ expected = { "foo": "bar",
+ "child": { "grandchild": { } }
+ }
+ self.assertEqual(expected, res)
+
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(jsonpatch))