Sets
touch src/sets.py tests/test_sets.pyDeduplication
class TestSets:
def test_items_are_deduplicated(self):
"""
Given multiple identical strings
When they are added to a set
Then the set only contains the 1 unique item
"""
# Given
items = set()
duplicated_item = "a"
# When
for _ in range(5):
items = add_item_to_set(items=items, item=duplicated_item)
# Then
assert len(items) == 1
assert duplicated_item in items
Difference
Summary
Last updated