Skip to content

Commit 282beba

Browse files
committed
Extend tests that check list patching
1 parent 66c4fa4 commit 282beba

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,17 @@ def test_use_move_instead_of_remove_add(self):
327327
self.assertEqual(res, dst)
328328

329329
def test_use_move_instead_of_add_remove(self):
330-
src = {'foo': [1, 2, 3]}
331-
dst = {'foo': [3, 1, 2]}
332-
patch = list(jsonpatch.make_patch(src, dst))
333-
self.assertEqual(len(patch), 1)
334-
self.assertEqual(patch[0]['op'], 'move')
335-
res = jsonpatch.apply_patch(src, patch)
336-
self.assertEqual(res, dst)
330+
def fn(_src, _dst):
331+
patch = list(jsonpatch.make_patch(_src, _dst))
332+
self.assertEqual(len(patch), 1)
333+
self.assertEqual(patch[0]['op'], 'move')
334+
res = jsonpatch.apply_patch(_src, patch)
335+
self.assertEqual(res, _dst)
336+
337+
fn({'foo': [1, 2, 3]}, {'foo': [3, 1, 2]})
338+
fn({'foo': [1, 2, 3]}, {'foo': [3, 2, 1]})
339+
fn([1, 2, 3], [3, 1, 2])
340+
fn([1, 2, 3], [3, 2, 1])
337341

338342
def test_escape(self):
339343
src = {"x/y": 1}

0 commit comments

Comments
 (0)