def test_init_with_items(self): items = [3, 5, 7, 2, 1, 'yeehaw'] ht = HashedSet(items) assert ht._size() == 6 assert ht.has('yeehaw') == True assert ht.has('') == False
def test_remove(self): ht = HashedSet(['A', 'B']) ht.remove('A') assert ht._size() == 1 assert ht.has('A') == False ht.remove('B') assert ht._size() == 0 assert ht.has('B') == False
def test_has(self): ht = HashedSet([3, 5, 7, 2, 1, 'yeehaw']) assert ht._size() == 6 assert ht.has(5) == True ht.remove(5) assert ht.has(5) == False assert ht._size() == 5 assert ht.has('A') == False assert ht.has('yeehaw') == True
def test_add(self): ht = HashedSet() assert ht._size() == 0 ht.add('A') assert ht._size() == 1 assert ht.has('A') == True ht.add('B') assert ht._size() == 2 assert ht.has('B') == True