@@ -73,8 +73,8 @@ def test_list_difference_add_delta(self):
7373
7474 flat_result1 = delta .to_flat_rows ()
7575 flat_expected1 = [
76- FlatDeltaRow (path = [3 ], value = 5 , action = 'iterable_item_added' ),
77- FlatDeltaRow (path = [2 ], value = 3 , action = 'iterable_item_added' ),
76+ FlatDeltaRow (path = [3 ], value = 5 , action = 'iterable_item_added' , type = int ),
77+ FlatDeltaRow (path = [2 ], value = 3 , action = 'iterable_item_added' , type = int ),
7878 ]
7979
8080 assert flat_expected1 == flat_result1
@@ -291,9 +291,9 @@ def test_list_difference3_delta(self):
291291
292292 flat_result1 = delta .to_flat_rows ()
293293 flat_expected1 = [
294- FlatDeltaRow (path = [4 , 'b' , 2 ], action = 'values_changed' , value = 2 , old_value = 5 ),
295- FlatDeltaRow (path = [4 , 'b' , 1 ], action = 'values_changed' , value = 3 , old_value = 2 ),
296- FlatDeltaRow (path = [4 , 'b' , 3 ], value = 5 , action = 'iterable_item_added' ),
294+ FlatDeltaRow (path = [4 , 'b' , 2 ], action = 'values_changed' , value = 2 , old_value = 5 , type = int , old_type = int ),
295+ FlatDeltaRow (path = [4 , 'b' , 1 ], action = 'values_changed' , value = 3 , old_value = 2 , type = int , old_type = int ),
296+ FlatDeltaRow (path = [4 , 'b' , 3 ], value = 5 , action = 'iterable_item_added' , type = int ),
297297 ]
298298
299299 assert flat_expected1 == flat_result1
@@ -332,9 +332,9 @@ def test_list_difference_delta_raises_error_if_prev_value_does_not_match(self):
332332
333333 flat_result2 = delta2 .to_flat_rows ()
334334 flat_expected2 = [
335- FlatDeltaRow (path = [2 ], action = 'values_changed' , value = 2 , old_value = 5 ),
336- FlatDeltaRow (path = [1 ], action = 'values_changed' , value = 3 , old_value = 2 ),
337- FlatDeltaRow (path = [3 ], value = 5 , action = 'iterable_item_added' ),
335+ FlatDeltaRow (path = [2 ], action = 'values_changed' , value = 2 , old_value = 5 , type = int , old_type = int ),
336+ FlatDeltaRow (path = [1 ], action = 'values_changed' , value = 3 , old_value = 2 , type = int , old_type = int ),
337+ FlatDeltaRow (path = [3 ], value = 5 , action = 'iterable_item_added' , type = int ),
338338 ]
339339
340340 assert flat_expected2 == flat_result2
@@ -363,8 +363,8 @@ def test_list_difference_delta1(self):
363363
364364 flat_result = delta .to_flat_rows ()
365365 flat_expected = [
366- FlatDeltaRow (path = [4 , 'b' , 2 ], value = 'to_be_removed' , action = 'iterable_item_removed' ),
367- FlatDeltaRow (path = [4 , 'b' , 3 ], value = 'to_be_removed2' , action = 'iterable_item_removed' ),
366+ FlatDeltaRow (path = [4 , 'b' , 2 ], value = 'to_be_removed' , action = 'iterable_item_removed' , type = str ),
367+ FlatDeltaRow (path = [4 , 'b' , 3 ], value = 'to_be_removed2' , action = 'iterable_item_removed' , type = str ),
368368 ]
369369
370370 assert flat_expected == flat_result
@@ -567,7 +567,8 @@ def compare_func(item1, item2, level=None):
567567 'professionalDesignation' : '' ,
568568 'suffix' : 'SR' ,
569569 'nameIdentifier' : '00003' },
570- action = 'unordered_iterable_item_added' ),
570+ action = 'unordered_iterable_item_added' ,
571+ type = dict ),
571572 FlatDeltaRow (path = ['individualNames' , 1 ],
572573 value = {'firstName' : 'John' ,
573574 'lastName' : 'Doe' ,
@@ -577,7 +578,9 @@ def compare_func(item1, item2, level=None):
577578 'professionalDesignation' : '' ,
578579 'suffix' : 'SR' ,
579580 'nameIdentifier' : '00002' },
580- action = 'unordered_iterable_item_removed' )]
581+ action = 'unordered_iterable_item_removed' ,
582+ type = dict ),
583+ ]
581584
582585 preserved_flat_dict_list = copy .deepcopy (flat_rows_list ) # Use this later for assert comparison
583586
@@ -1405,13 +1408,13 @@ def test_list_ignore_order_various_deltas2(self):
14051408
14061409 flat_result1 = delta1 .to_flat_rows ()
14071410 flat_expected1 = [
1408- {'path' : [0 ], 'value' : 7 , 'action' : 'unordered_iterable_item_added' },
1409- {'path' : [6 ], 'value' : 8 , 'action' : 'unordered_iterable_item_added' },
1410- {'path' : [1 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1411- {'path' : [2 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1412- {'path' : [5 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1413- {'path' : [6 ], 'value' : 6 , 'action' : 'unordered_iterable_item_removed' },
1414- {'path' : [0 ], 'value' : 5 , 'action' : 'unordered_iterable_item_removed' },
1411+ {'path' : [0 ], 'value' : 7 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1412+ {'path' : [6 ], 'value' : 8 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1413+ {'path' : [1 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1414+ {'path' : [2 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1415+ {'path' : [5 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1416+ {'path' : [6 ], 'value' : 6 , 'action' : 'unordered_iterable_item_removed' , 'type' : int },
1417+ {'path' : [0 ], 'value' : 5 , 'action' : 'unordered_iterable_item_removed' , 'type' : int },
14151418 ]
14161419 flat_expected1 = [FlatDeltaRow (** i ) for i in flat_expected1 ]
14171420 assert flat_expected1 == flat_result1
@@ -1422,11 +1425,11 @@ def test_list_ignore_order_various_deltas2(self):
14221425
14231426 flat_result2 = delta2 .to_flat_rows ()
14241427 flat_expected2 = [
1425- {'path' : [1 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1426- {'path' : [2 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1427- {'path' : [5 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' },
1428- {'path' : [6 ], 'action' : 'values_changed' , 'value' : 7 },
1429- {'path' : [0 ], 'action' : 'values_changed' , 'value' : 8 },
1428+ {'path' : [1 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1429+ {'path' : [2 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1430+ {'path' : [5 ], 'value' : 4 , 'action' : 'unordered_iterable_item_added' , 'type' : int },
1431+ {'path' : [6 ], 'action' : 'values_changed' , 'value' : 7 , 'type' : int },
1432+ {'path' : [0 ], 'action' : 'values_changed' , 'value' : 8 , 'type' : int },
14301433 ]
14311434 flat_expected2 = [FlatDeltaRow (** i ) for i in flat_expected2 ]
14321435 assert flat_expected2 == flat_result2
@@ -1565,7 +1568,7 @@ def test_apply_delta_to_incompatible_object6_value_change(self):
15651568 assert [] == t4
15661569
15671570 flat_result2 = delta2 .to_flat_rows ()
1568- flat_expected2 = [{'path' : [1 , 2 , 0 ], 'action' : 'values_changed' , 'value' : 5 }]
1571+ flat_expected2 = [{'path' : [1 , 2 , 0 ], 'action' : 'values_changed' , 'value' : 5 , 'type' : int }]
15691572 flat_expected2 = [FlatDeltaRow (** i ) for i in flat_expected2 ]
15701573
15711574 assert flat_expected2 == flat_result2
@@ -1575,7 +1578,7 @@ def test_apply_delta_to_incompatible_object6_value_change(self):
15751578
15761579 delta3 = Delta (diff , raise_errors = False , bidirectional = True )
15771580 flat_result3 = delta3 .to_flat_rows ()
1578- flat_expected3 = [{'path' : [1 , 2 , 0 ], 'action' : 'values_changed' , 'value' : 5 , 'old_value' : 4 }]
1581+ flat_expected3 = [{'path' : [1 , 2 , 0 ], 'action' : 'values_changed' , 'value' : 5 , 'old_value' : 4 , 'type' : int , 'old_type' : int }]
15791582 flat_expected3 = [FlatDeltaRow (** i ) for i in flat_expected3 ]
15801583
15811584 assert flat_expected3 == flat_result3
@@ -1685,7 +1688,7 @@ def test_delta_to_dict(self):
16851688 assert expected == result
16861689
16871690 flat_result = delta .to_flat_rows ()
1688- flat_expected = [{'action' : 'unordered_iterable_item_removed' , 'path' : [2 ], 'value' : 'B' }]
1691+ flat_expected = [{'action' : 'unordered_iterable_item_removed' , 'path' : [2 ], 'value' : 'B' , 'type' : str }]
16891692 flat_expected = [FlatDeltaRow (** i ) for i in flat_expected ]
16901693
16911694 assert flat_expected == flat_result
@@ -1766,10 +1769,10 @@ def test_delta_set_in_objects(self):
17661769 delta = Delta (DeepDiff (t1 , t2 ))
17671770 flat_result = delta .to_flat_rows ()
17681771 flat_expected = [
1769- {'path' : [0 , 1 ], 'value' : 10 , 'action' : 'set_item_added' },
1770- {'path' : [0 , 0 ], 'action' : 'values_changed' , 'value' : 2 },
1771- {'path' : [0 , 1 ], 'value' : 'A' , 'action' : 'set_item_removed' },
1772- {'path' : [0 , 1 ], 'value' : 'C' , 'action' : 'set_item_added' },
1772+ {'path' : [0 , 1 ], 'value' : 10 , 'action' : 'set_item_added' , 'type' : int },
1773+ {'path' : [0 , 0 ], 'action' : 'values_changed' , 'value' : 2 , 'type' : int },
1774+ {'path' : [0 , 1 ], 'value' : 'A' , 'action' : 'set_item_removed' , 'type' : str },
1775+ {'path' : [0 , 1 ], 'value' : 'C' , 'action' : 'set_item_added' , 'type' : str },
17731776 ]
17741777 flat_expected = [FlatDeltaRow (** i ) for i in flat_expected ]
17751778
@@ -1885,11 +1888,11 @@ def test_compare_func_with_duplicates_removed(self):
18851888
18861889 flat_result = delta .to_flat_rows ()
18871890 flat_expected = [
1888- {'path' : [2 ], 'value' : {'id' : 1 , 'val' : 3 }, 'action' : 'iterable_item_removed' },
1889- {'path' : [0 ], 'value' : {'id' : 1 , 'val' : 3 }, 'action' : 'iterable_item_removed' },
1890- {'path' : [3 ], 'value' : {'id' : 3 , 'val' : 3 }, 'action' : 'iterable_item_removed' },
1891- {'path' : [0 ], 'action' : 'iterable_item_moved' , 'value' : {'id' : 1 , 'val' : 3 }, 'new_path' : [2 ]},
1892- {'path' : [3 ], 'action' : 'iterable_item_moved' , 'value' : {'id' : 3 , 'val' : 3 }, 'new_path' : [0 ]},
1891+ {'path' : [2 ], 'value' : {'id' : 1 , 'val' : 3 }, 'action' : 'iterable_item_removed' , 'type' : dict },
1892+ {'path' : [0 ], 'value' : {'id' : 1 , 'val' : 3 }, 'action' : 'iterable_item_removed' , 'type' : dict },
1893+ {'path' : [3 ], 'value' : {'id' : 3 , 'val' : 3 }, 'action' : 'iterable_item_removed' , 'type' : dict },
1894+ {'path' : [0 ], 'action' : 'iterable_item_moved' , 'value' : {'id' : 1 , 'val' : 3 }, 'new_path' : [2 ], 'type' : dict },
1895+ {'path' : [3 ], 'action' : 'iterable_item_moved' , 'value' : {'id' : 3 , 'val' : 3 }, 'new_path' : [0 ], 'type' : dict },
18931896 ]
18941897 flat_expected = [FlatDeltaRow (** i ) for i in flat_expected ]
18951898
@@ -2289,11 +2292,13 @@ def test_subtract_delta_made_from_flat_dicts1(self):
22892292 expected_flat_dicts = [{
22902293 'path' : ['field_name1' , 0 ],
22912294 'value' : 'xxx' ,
2292- 'action' : 'iterable_item_removed'
2295+ 'action' : 'iterable_item_removed' ,
2296+ 'type' : str ,
22932297 }, {
22942298 'path' : ['field_name1' , 1 ],
22952299 'value' : 'yyy' ,
2296- 'action' : 'iterable_item_removed'
2300+ 'action' : 'iterable_item_removed' ,
2301+ 'type' : str ,
22972302 }]
22982303 expected_flat_dicts = [FlatDeltaRow (** i ) for i in expected_flat_dicts ]
22992304
@@ -2318,11 +2323,13 @@ def test_subtract_delta_made_from_flat_dicts2(self):
23182323 expected_flat_dicts = [{
23192324 'path' : ['field_name1' , 0 ],
23202325 'value' : 'xxx' ,
2321- 'action' : 'iterable_item_added'
2326+ 'action' : 'iterable_item_added' ,
2327+ 'type' : str ,
23222328 }, {
23232329 'path' : ['field_name1' , 1 ],
23242330 'value' : 'yyy' ,
2325- 'action' : 'iterable_item_added'
2331+ 'action' : 'iterable_item_added' ,
2332+ 'type' : str ,
23262333 }]
23272334 expected_flat_dicts = [FlatDeltaRow (** i ) for i in expected_flat_dicts ]
23282335
0 commit comments