summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2020-01-28 19:03:52 +0100
committerGitHub <noreply@github.com>2020-01-28 19:03:52 +0100
commitb3726f3a8bdcdf0f0841e078228014de8477b0ec (patch)
treeaaaae012bdbbfedf9d1d4951e2663994a8c91f6b /tests.py
parent3e44e04f640a1c10b68d00d2b9a6af0c397f06d7 (diff)
parent041036376a301300ea3dc1a8d236bb61f8567bca (diff)
downloadpython-json-patch-b3726f3a8bdcdf0f0841e078228014de8477b0ec.tar.gz
Merge pull request #96 from gdraynz/replace-array-indexerror
Ensure an item is within the upper array boundaries before replacing it
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 07f923b..28f0201 100755
--- a/tests.py
+++ b/tests.py
@@ -611,6 +611,11 @@ class ConflictTests(unittest.TestCase):
patch_obj = [ { "op": "replace", "path": "/foo/10", "value": 10} ]
self.assertRaises(jsonpatch.JsonPatchConflict, jsonpatch.apply_patch, src, patch_obj)
+ def test_replace_oob_length(self):
+ src = {"foo": [0, 1]}
+ patch_obj = [ { "op": "replace", "path": "/foo/2", "value": 2} ]
+ self.assertRaises(jsonpatch.JsonPatchConflict, jsonpatch.apply_patch, src, patch_obj)
+
def test_replace_missing(self):
src = {"foo": 1}
patch_obj = [ { "op": "replace", "path": "/bar", "value": 10} ]