summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2012-11-15 11:25:48 +0100
committerStefan Kögl <stefan@skoegl.net>2012-11-15 11:27:31 +0100
commitae11875d59b4c7ddb93e5d027adf13aa4bfed670 (patch)
tree28819ff9a2ff41188793d3ab1d83de66f4adede3 /tests.py
parent14b239c02cb7fb28b01b9b458b4a140cf4b9ccfd (diff)
downloadpython-json-patch-ae11875d59b4c7ddb93e5d027adf13aa4bfed670.tar.gz
use jsonpointer, update to current spec draft
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 6268f39..3407136 100755
--- a/tests.py
+++ b/tests.py
@@ -136,6 +136,20 @@ class ApplyPatchTestCase(unittest.TestCase):
obj, [{'op': 'test', 'path': '/baz/qx'}])
+ def test_unrecognized_element(self):
+ obj = {'foo': 'bar', 'baz': 'qux'}
+ res = jsonpatch.apply_patch(obj, [{'op': 'replace', 'path': '/baz', 'value': 'boo', 'foo': 'ignore'}])
+ self.assertTrue(res['baz'], 'boo')
+
+
+ def test_append(self):
+ obj = {'foo': [1, 2]}
+ res = jsonpatch.apply_patch(obj, [
+ {'op': 'add', 'path': '/foo/-', 'value': 3},
+ {'op': 'add', 'path': '/foo/-', 'value': 4},
+ ])
+
+
class EqualityTestCase(unittest.TestCase):