File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,18 @@ def test_move_from_numeric_to_alpha_dict_key(self):
483
483
patch = jsonpatch .make_patch (src , dst )
484
484
res = jsonpatch .apply_patch (src , patch )
485
485
self .assertEqual (res , dst )
486
+
487
+ def test_list_of_lists_add (self ):
488
+ """Test patch when inserting an element into a list of lists."""
489
+ a = [[1 ,'a' ]]
490
+ b = [[2 ,'b' ], [1 ,'a' ]]
491
+ patch = jsonpatch .make_patch (a , b )
492
+ self .assertEqual (len (patch .patch ), 1 )
493
+ self .assertEqual (patch .patch [0 ]['op' ], 'add' )
494
+ self .assertEqual (patch .patch [0 ]['path' ], '/0' )
495
+ self .assertEqual (patch .patch [0 ]['value' ], [2 , 'b' ])
496
+ res = jsonpatch .apply_patch (a , patch )
497
+ self .assertEqual (res , b )
486
498
487
499
def test_issue90 (self ):
488
500
"""In JSON 1 is different from True even though in python 1 == True"""
You can’t perform that action at this time.
0 commit comments