1class Cud():
2
3    def __init__(self):
4        #print("__init__ called")
5        pass
6
7    def __repr__(self):
8        print("__repr__ called")
9        return ""
10
11    def __lt__(self, other):
12        print("__lt__ called")
13
14    def __le__(self, other):
15        print("__le__ called")
16
17    def __eq__(self, other):
18        print("__eq__ called")
19
20    def __ne__(self, other):
21        print("__ne__ called")
22
23    def __ge__(self, other):
24        print("__ge__ called")
25
26    def __gt__(self, other):
27        print("__gt__ called")
28
29    def __abs__(self):
30        print("__abs__ called")
31
32    def __add__(self, other):
33        print("__add__ called")
34
35    def __and__(self, other):
36        print("__and__ called")
37
38    def __floordiv__(self, other):
39        print("__floordiv__ called")
40
41    def __index__(self, other):
42        print("__index__ called")
43
44    def __inv__(self):
45        print("__inv__ called")
46
47    def __invert__(self):
48        print("__invert__ called")
49
50    def __lshift__(self, val):
51        print("__lshift__ called")
52
53    def __mod__(self, val):
54        print("__mod__ called")
55
56    def __mul__(self, other):
57        print("__mul__ called")
58
59    def __matmul__(self, other):
60        print("__matmul__ called")
61
62    def __neg__(self):
63        print("__neg__ called")
64
65    def __or__(self, other):
66        print("__or__ called")
67
68    def __pos__(self):
69        print("__pos__ called")
70
71    def __pow__(self, val):
72        print("__pow__ called")
73
74    def __rshift__(self, val):
75        print("__rshift__ called")
76
77    def __sub__(self, other):
78        print("__sub__ called")
79
80    def __truediv__(self, other):
81        print("__truediv__ called")
82
83    def __div__(self, other):
84        print("__div__ called")
85
86    def __xor__(self, other):
87        print("__xor__ called")
88
89    def __iadd__(self, other):
90        print("__iadd__ called")
91        return self
92
93    def __isub__(self, other):
94        print("__isub__ called")
95        return self
96
97    def __dir__(self):
98        return ['a', 'b', 'c']
99
100cud1 = Cud()
101cud2 = Cud()
102
103try:
104    +cud1
105except TypeError:
106    print("SKIP")
107    raise SystemExit
108
109# the following require MICROPY_PY_ALL_SPECIAL_METHODS
110+cud1
111-cud1
112~cud1
113cud1 * cud2
114cud1 @ cud2
115cud1 / cud2
116cud2 // cud1
117cud1 += cud2
118cud1 -= cud2
119cud1 % 2
120cud1 ** 2
121cud1 | cud2
122cud1 & cud2
123cud1 ^ cud2
124cud1 << 1
125cud1 >> 1
126
127# test that dir() delegates to __dir__ special method
128print(dir(cud1))
129
130# test that dir() does not delegate to __dir__ for the type
131print('a' in dir(Cud))
132