summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2012-09-05 17:21:43 +0200
committerStefan Kögl <stefan@skoegl.net>2012-09-05 17:21:43 +0200
commit5480cc5a8be2313a37e7cc2a1c265e91c51d86aa (patch)
tree81aee425169f89a8b3bfe76696903a5b32c821be /tests.py
parentffd125cd891b47c66b9eb18a04411c47aa880d90 (diff)
downloadpython-json-patch-5480cc5a8be2313a37e7cc2a1c265e91c51d86aa.tar.gz
ref current spec, add its new test case
the updated spec [1] didn't change anything that would make a new version of python-json-patch necessary. This commit only updates the reference to the current version, and adds a new example [1] http://tools.ietf.org/html/draft-ietf-appsawg-json-patch-03
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py10
1 files changed, 10 insertions, 0 deletions
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))