def test_contains(self): s = HashSet() s.add('S') assert s.contains('S') == True assert s.contains('H') == False s.add('H') assert s.contains('H') == True assert s.contains('S') == True
def test_remove(self): hs = HashSet([1, 2, 3]) assert hs.items() == [1, 2, 3] assert hs.contains(3) == True assert hs.size == 3 # remove item hs.remove(3) assert hs.items() == [1, 2] assert hs.contains(3) == False assert hs.size == 2 with self.assertRaises(KeyError): hs.remove(3)
def test_contains(self): hs = HashSet([1, 2, 3]) assert hs.contains(2) == True assert hs.contains(4) == False