summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorVu-Hoang Phan <vu-hoang.phan@ubisoft.com>2021-04-06 13:33:18 +0200
committerVu-Hoang Phan <vu-hoang.phan@ubisoft.com>2021-04-06 13:52:39 +0200
commitdb194f820dee88e1a66a811a7a8653cce6965bc3 (patch)
tree8a5096edfbdf094f1496a7bb5ebdcf193954ac2c /tests.py
parenta6526489c4b741e1b603b5bb988ecc9aefd3e880 (diff)
downloadpython-json-patch-db194f820dee88e1a66a811a7a8653cce6965bc3.tar.gz
fix invalid remove index
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 797c220..d9eea92 100755
--- a/tests.py
+++ b/tests.py
@@ -87,6 +87,12 @@ class ApplyPatchTestCase(unittest.TestCase):
res = jsonpatch.apply_patch(obj, [{'op': 'remove', 'path': '/foo/1'}])
self.assertEqual(res['foo'], ['bar', 'baz'])
+ def test_remove_invalid_item(self):
+ obj = {'foo': ['bar', 'qux', 'baz']}
+ with self.assertRaises(jsonpointer.JsonPointerException):
+ jsonpatch.apply_patch(obj, [{'op': 'remove', 'path': '/foo/-'}])
+
+
def test_replace_object_key(self):
obj = {'foo': 'bar', 'baz': 'qux'}
res = jsonpatch.apply_patch(obj, [{'op': 'replace', 'path': '/baz', 'value': 'boo'}])