1# Test inplace special methods enabled by MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS 2 3 4class A: 5 def __imul__(self, other): 6 print("__imul__") 7 return self 8 9 def __imatmul__(self, other): 10 print("__imatmul__") 11 return self 12 13 def __ifloordiv__(self, other): 14 print("__ifloordiv__") 15 return self 16 17 def __itruediv__(self, other): 18 print("__itruediv__") 19 return self 20 21 def __imod__(self, other): 22 print("__imod__") 23 return self 24 25 def __ipow__(self, other): 26 print("__ipow__") 27 return self 28 29 def __ior__(self, other): 30 print("__ior__") 31 return self 32 33 def __ixor__(self, other): 34 print("__ixor__") 35 return self 36 37 def __iand__(self, other): 38 print("__iand__") 39 return self 40 41 def __ilshift__(self, other): 42 print("__ilshift__") 43 return self 44 45 def __irshift__(self, other): 46 print("__irshift__") 47 return self 48 49 50a = A() 51 52try: 53 a *= None 54except TypeError: 55 print("SKIP") 56 raise SystemExit 57 58a @= None 59a //= None 60a /= None 61a %= None 62a **= None 63a |= None 64a ^= None 65a &= None 66a <<= None 67a >>= None 68 69# Normal operator should not fallback to inplace operator 70try: 71 a * None 72except TypeError: 73 print("TypeError") 74