def test_collision(): HASH = 13465345 mp = PersistentTreeSet() mp = mp.add(HashCollision("hello", HASH)) mp = mp.add(HashCollision("answer", HASH)) assert HashCollision("hello", HASH) in mp assert HashCollision("answer", HASH) in mp
def test_persistence(): mp = PersistentTreeSet() mp1 = mp.add('a') assert 'a' in mp1 mp2 = mp1.add('b') assert 'a' in mp2 assert 'b' in mp2 assert 'b' not in mp1 mp3 = mp2.without('a') assert 'b' in mp3 assert 'a' not in mp3