def test_remove_duplicates_without_seen(): empty_set = set() lists = [ ([], [], empty_set), ([1], [1], {1}), ([1, 1], [1], {1}), ([None], [None], {None}), ([None, None], [None], {None}), ([1, None], [1, None], {1, None}), (['a'], ['a'], {'a'}), (['a', 'a'], ['a'], {'a'}), (['a', 'b'], ['a', 'b'], {'a', 'b'}), (['a', 'b', 'a'], ['a', 'b'], {'a', 'b'}), (['a', 'a', 'b'], ['a', 'b'], {'a', 'b'}), (['b', 'a', 'b'], ['b', 'a'], {'a', 'b'}), (['b', 'a', 'a'], ['b', 'a'], {'a', 'b'}), ([1, 2, 1, 2], [1, 2], {1, 2}), ] for l, reduced_l, seen in lists: actual_res = utils.remove_duplicates(l) assert actual_res == (reduced_l, seen), actual_res
def test_remove_duplicates_with_seen(): empty_set = set() lists = [ ([], empty_set, [], empty_set), ([], {None}, [], {None}), ([], {1}, [], {1}), ([], {1, 2}, [], {1, 2}), ([1], empty_set, [1], {1}), ([1], {1}, [], {1}), ([1, 1], empty_set, [1], {1}), ([1, 1], {1}, [], {1}), ([1, 1], {None}, [1], {1, None}), ([1, 1], {2}, [1], {1, 2}), ([1, 1], {1, 2}, [], {1, 2}), ([None], empty_set, [None], {None}), ([None], {1}, [None], {1, None}), ([None], {1, 2}, [None], {1, 2, None}), ([None], {1, 2}, [None], {2, 1, None}), ([None], {1, 2}, [None], {None, 2, 1}), ([None], {1, 2}, [None], {2, None, 1}), ([None], {1, 2, None}, [], {1, 2, None}), ([1, None], empty_set, [1, None], {1, None}), ([1, None], {1}, [None], {1, None}), ([1, None], {None}, [1], {1, None}), ([1, None], {1, None}, [], {1, None}), ([1, None], {1, None, 2}, [], {1, None, 2}), ([None, 1], empty_set, [None, 1], {1, None}), ([None, 1], {1}, [None], {1, None}), ([None, 1], {None}, [1], {1, None}), ([None, 1], {1, None}, [], {1, None}), ([None, 1], {1, None, 2}, [], {1, None, 2}), (['a'], empty_set, ['a'], {'a'}), (['a'], {'a'}, [], {'a'}), (['a'], {None}, ['a'], {'a', None}), (['a'], {'b'}, ['a'], {'a', 'b'}), (['a'], {'a', 'b'}, [], {'a', 'b'}), (['a'], {'a', 'b', tuple()}, [], {'a', 'b', tuple()}), # (['a', 'a'], ['a'], {'a'}), # (['a', 'b'], ['a', 'b'], {'a', 'b'}), # (['a', 'b', 'a'], ['a', 'b'], {'a', 'b'}), # (['a', 'a', 'b'], ['a', 'b'], {'a', 'b'}), # (['b', 'a', 'b'], ['b', 'a'], {'a', 'b'}), # (['b', 'a', 'a'], ['b', 'a'], {'a', 'b'}), # ([1, 2, 1, 2], [1, 2], {1, 2}), # ([1, 2, 1, 2], [1, 2], {1, 2}), ] for l, seen_before, reduced_l, seen_after in lists: actual_res = utils.remove_duplicates(l, seen_before) assert actual_res == (reduced_l, seen_after), actual_res