Skip to content

Commit b775e4f

Browse files
committed
adding test cases for #344
1 parent 17001c1 commit b775e4f

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

tests/test_ignore_order.py

+38-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_nested_list_with_dictionarry_difference_ignore_order(self):
149149
result = {}
150150
assert result == ddiff
151151

152-
def test_list_difference_ignore_order_report_repetition(self):
152+
def test_list_difference_ignore_order_report_repetition1(self):
153153
t1 = [1, 3, 1, 4]
154154
t2 = [4, 4, 1]
155155
ddiff = DeepDiff(t1, t2, ignore_order=True, report_repetition=True)
@@ -176,6 +176,43 @@ def test_list_difference_ignore_order_report_repetition(self):
176176
}
177177
assert result == ddiff
178178

179+
@pytest.mark.skip
180+
def test_list_difference_ignore_order_report_repetition2(self):
181+
t1 = [1, 1, 1]
182+
t2 = [2, 2]
183+
ddiff = DeepDiff(t1, t2, ignore_order=True)
184+
result = {'values_changed': {'root[0]': {'new_value': 2, 'old_value': 1}}}
185+
assert result == ddiff
186+
187+
ddiff2 = DeepDiff(t1, t2, ignore_order=True, report_repetition=True, cutoff_intersection_for_pairs=1, cutoff_distance_for_pairs=1)
188+
result2 = {
189+
'iterable_item_removed': {
190+
'root[0]': 1,
191+
'root[1]': 1,
192+
'root[2]': 1
193+
},
194+
'iterable_item_added': {
195+
'root[0]': 2,
196+
'root[1]': 2,
197+
},
198+
}
199+
assert result2 == ddiff2
200+
201+
@pytest.mark.skip
202+
def test_list_difference_ignore_order_report_repetition3(self):
203+
t1 = [{"id": 1}, {"id": 1}, {"id": 1}]
204+
t2 = [{"id": 1, "name": 1}]
205+
206+
ddiff2 = DeepDiff(t1, t2, ignore_order=True, report_repetition=True, cutoff_intersection_for_pairs=1, cutoff_distance_for_pairs=1)
207+
result2 = {
208+
'iterable_item_removed': {
209+
'root[1]': {"id": 1},
210+
'root[2]': {"id": 1},
211+
},
212+
'dictionary_item_added': ["root[0]['name']"]
213+
}
214+
assert result2 == ddiff2
215+
179216
def test_nested_list_ignore_order_report_repetition(self):
180217
t1 = [1, 2, [3, 4]]
181218
t2 = [[4, 3, 3], 2, 1]

0 commit comments

Comments
 (0)