Skip to content

Commit 50fb942

Browse files
author
Artyom Nikitin
committed
tests: moar
1 parent c9613e3 commit 50fb942

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,44 @@ def test_make_patch(self):
738738
self.assertEqual(op.pointer_cls, CustomJsonPointer)
739739

740740
def test_operations(self):
741+
operations =[
742+
(
743+
jsonpatch.AddOperation, {
744+
'op': 'add', 'path': '/foo', 'value': [1, 2, 3]
745+
}
746+
),
747+
(
748+
jsonpatch.MoveOperation, {
749+
'op': 'move', 'path': '/baz', 'from': '/foo'
750+
},
751+
),
752+
(
753+
jsonpatch.RemoveOperation, {
754+
'op': 'remove', 'path': '/baz/1'
755+
},
756+
),
757+
(
758+
jsonpatch.TestOperation, {
759+
'op': 'test', 'path': '/baz', 'value': [1, 3]
760+
},
761+
),
762+
(
763+
jsonpatch.ReplaceOperation, {
764+
'op': 'replace', 'path': '/baz/0', 'value': 42
765+
},
766+
),
767+
(
768+
jsonpatch.RemoveOperation, {
769+
'op': 'remove', 'path': '/baz/1'
770+
},
771+
)
772+
]
773+
for cls, patch in operations:
774+
operation = cls(patch, pointer_cls=CustomJsonPointer)
775+
self.assertEqual(operation.pointer_cls, CustomJsonPointer)
776+
self.assertIsInstance(operation.pointer, CustomJsonPointer)
777+
778+
def test_operations_from_patch(self):
741779
patch = jsonpatch.JsonPatch([
742780
{'op': 'add', 'path': '/foo', 'value': [1, 2, 3]},
743781
{'op': 'move', 'path': '/baz', 'from': '/foo'},

0 commit comments

Comments
 (0)