def test_same_list_shuffled_is_not_different_nested(path, xs): """No difference between two lists with same values in different order. This variant is for when there are nested lists, to catch loop / mutation issues. """ ys = copy.deepcopy(xs) random.shuffle(ys) assert list(diff_lists(path, xs, ys)) == []
def test_diff_lists_doesnt_mutate_inputs_nested_lists(path, items): xs, ys = items orig_xs = copy.deepcopy(xs) orig_ys = copy.deepcopy(ys) diff_lists(path, xs, ys) assert xs == orig_xs and ys == orig_ys
def test_diff_lists_doesnt_mutate_inputs(path, items): xs, ys = items orig_xs = list(xs) orig_ys = list(ys) diff_lists(path, xs, ys) assert xs == orig_xs and ys == orig_ys
def test_added_items_appear_in_diff(path, base, extension): xs = list(base) xs.extend([None] * len(extension)) ys = list(base) ys.extend(extension) assert len(list(diff_lists(path, xs, ys))) == len(extension)
def test_same_list_shuffled_is_not_different(path, xs): """No difference between two lists with same values in different order.""" ys = list(xs) random.shuffle(ys) assert list(diff_lists(path, xs, ys)) == []
def test_diff_lists_equal(path, xs): """No difference between a list and itself.""" assert list(diff_lists(path, xs, xs)) == []