@@ -595,6 +595,7 @@ def compare_func(item1, item2, level=None):
595595        delta  =  Delta (flat_rows_list = flat_rows_list ,
596596                      always_include_values = True , bidirectional = True , raise_errors = True )
597597
598+         flat_rows_list_again  =  delta .to_flat_rows ()
598599        # if the flat_rows_list is (unexpectedly) mutated, it will be missing the list index number on the path value. 
599600        old_mutated_list_missing_indexes_on_path  =  [FlatDeltaRow (path = ['individualNames' ],
600601                                         value = {'firstName' : 'Johnny' ,
@@ -620,6 +621,7 @@ def compare_func(item1, item2, level=None):
620621        # Verify that our fix in the delta constructor worked... 
621622        assert  flat_rows_list  !=  old_mutated_list_missing_indexes_on_path 
622623        assert  flat_rows_list  ==  preserved_flat_dict_list 
624+         assert  flat_rows_list  ==  flat_rows_list_again 
623625
624626
625627picklalbe_obj_without_item  =  PicklableClass (11 )
@@ -874,6 +876,13 @@ def compare_func(item1, item2, level=None):
874876        'to_delta_kwargs' : {'directed' : True },
875877        'expected_delta_dict' : {'values_changed' : {'root["a\' ][\' b\' ][\' c"]' : {'new_value' : 2 }}}
876878    },
879+     'delta_case21_empty_list_add' : {
880+         't1' : {'car_model' : [], 'car_model_version_id' : 0 },
881+         't2' : {'car_model' : ['Super Duty F-250' ], 'car_model_version_id' : 1 },
882+         'deepdiff_kwargs' : {},
883+         'to_delta_kwargs' : {'directed' : True },
884+         'expected_delta_dict' : {'iterable_item_added' : {"root['car_model'][0]" : 'Super Duty F-250' }, 'values_changed' : {"root['car_model_version_id']" : {'new_value' : 1 }}},
885+     },
877886}
878887
879888
@@ -2469,6 +2478,33 @@ def test_delta_flat_rows(self):
24692478        delta2  =  Delta (flat_rows_list = flat_rows , bidirectional = True , force = True )
24702479        assert  t1  +  delta2  ==  t2 
24712480
2481+     def  test_delta_bool (self ):
2482+         flat_rows_list  =  [FlatDeltaRow (path = ['dollar_to_cent' ], action = 'values_changed' , value = False , old_value = True , type = bool , old_type = bool )]
2483+         value  =  {'dollar_to_cent' : False }
2484+         delta  =  Delta (flat_rows_list = flat_rows_list , bidirectional = True , force = True )
2485+         assert  {'dollar_to_cent' : True } ==  value  -  delta 
2486+ 
2487+     def  test_detla_add_to_empty_iterable_and_flatten (self ):
2488+         t1  =  {'models' : [], 'version_id' : 0 }
2489+         t2  =  {'models' : ['Super Duty F-250' ], 'version_id' : 1 }
2490+         t3  =  {'models' : ['Super Duty F-250' , 'Focus' ], 'version_id' : 1 }
2491+         diff  =  DeepDiff (t1 , t2 , verbose_level = 2 )
2492+         delta  =  Delta (diff , bidirectional = True )
2493+         assert  t1  +  delta  ==  t2 
2494+         flat_rows  =  delta .to_flat_rows ()
2495+         delta2  =  Delta (flat_rows_list = flat_rows , bidirectional = True )  # , force=True 
2496+         assert  t1  +  delta2  ==  t2 
2497+         assert  t2  -  delta2  ==  t1 
2498+ 
2499+         diff3  =  DeepDiff (t2 , t3 )
2500+         delta3  =  Delta (diff3 , bidirectional = True )
2501+         flat_dicts3  =  delta3 .to_flat_dicts ()
2502+ 
2503+         delta3_again  =  Delta (flat_dict_list = flat_dicts3 , bidirectional = True )
2504+         assert  t2  +  delta3_again  ==  t3 
2505+         assert  t3  -  delta3_again  ==  t2 
2506+ 
2507+ 
24722508    def  test_flat_dict_and_deeply_nested_dict (self ):
24732509        beforeImage  =  [
24742510            {
0 commit comments