def test_hashset_add(hashset): hashset['a'] = 'test1' hashset['b'] = 'test2' hashset['c'] = 'test3' assert len(hashset.keys()) == 3 assert sorted(hashset.keys()) == ['a', 'b', 'c'] assert len(hashset.values()) == 3 assert sorted(hashset.values()) == ['test1', 'test2', 'test3']
def test_hashset_del(hashset): hashset['a'] = 'test1' hashset['b'] = 'test2' hashset['c'] = 'test3' del hashset['a'] assert len(hashset.keys()) == 2 with pytest.raises(KeyError): print("Should raise an exception: {}".format(hashset['a']))