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
This commit is contained in:
@@ -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>'
|
||||
|
||||
10
tests.py
10
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))
|
||||
|
||||
Reference in New Issue
Block a user