1# basic test
2s = {1}
3print(s.remove(1))
4print(list(s))
5try:
6    print(s.remove(1), "!!!")
7except KeyError as er:
8    print('KeyError', er.args[0])
9else:
10    print("failed to raise KeyError")
11
12# test sets of varying size
13for n in range(20):
14    print('testing set with {} items'.format(n))
15    for i in range(n):
16        # create set
17        s = set()
18        for j in range(n):
19            s.add(str(j))
20        print(len(s))
21
22        # delete an item
23        s.remove(str(i))
24        print(len(s))
25
26        # check items
27        for j in range(n):
28            if str(j) in s:
29                if j == i:
30                    print(j, 'in s, but it should not be')
31            else:
32                if j != i:
33                    print(j, 'not in s, but it should be')
34