1s = {1}
2print(s.pop())
3try:
4    print(s.pop(), "!!!")
5except KeyError:
6    pass
7else:
8    print("Failed to raise KeyError")
9
10# this tests an optimisation in mp_set_remove_first
11# N must not be equal to one of the values in hash_allocation_sizes
12N = 11
13s = set(range(N))
14while s:
15    print(s.pop()) # last pop() should trigger the optimisation
16for i in range(N):
17    s.add(i) # check that we can add the numbers back to the set
18print(sorted(s))
19