1# sets, see set_containment
2for i in 1, 2:
3    for o in {1:2}, {1:2}.keys():
4        print("{} in {}: {}".format(i, str(o), i in o))
5        print("{} not in {}: {}".format(i, str(o), i not in o))
6
7haystack = "supercalifragilistc"
8for needle in [haystack[i:] for i in range(len(haystack))]:
9    print(needle, "in", haystack, "::", needle in haystack)
10    print(needle, "not in", haystack, "::", needle not in haystack)
11    print(haystack, "in", needle, "::", haystack in needle)
12    print(haystack, "not in", needle, "::", haystack not in needle)
13for needle in [haystack[:i+1] for i in range(len(haystack))]:
14    print(needle, "in", haystack, "::", needle in haystack)
15    print(needle, "not in", haystack, "::", needle not in haystack)
16    print(haystack, "in", needle, "::", haystack in needle)
17    print(haystack, "not in", needle, "::", haystack not in needle)
18
19# containment of bytes/ints in bytes
20print(b'' in b'123')
21print(b'0' in b'123', b'1' in b'123')
22print(48 in b'123', 49 in b'123')
23
24# containment of int in str is an error
25try:
26    1 in '123'
27except TypeError:
28    print('TypeError')
29
30# until here, the tests would work without the 'second attempt' iteration thing.
31
32for i in 1, 2:
33    for o in [], [1], [1, 2]:
34        print("{} in {}: {}".format(i, o, i in o))
35        print("{} not in {}: {}".format(i, o, i not in o))
36