1# tests basics of bound methods 2 3# uPy and CPython differ when printing a bound method, so just print the type 4print(type(repr([].append))) 5 6class A: 7 def f(self): 8 return 0 9 def g(self, a): 10 return a 11 def h(self, a, b, c, d, e, f): 12 return a + b + c + d + e + f 13 14# bound method with no extra args 15m = A().f 16print(m()) 17 18# bound method with 1 extra arg 19m = A().g 20print(m(1)) 21 22# bound method with lots of extra args 23m = A().h 24print(m(1, 2, 3, 4, 5, 6)) 25 26# can't assign attributes to a bound method 27try: 28 A().f.x = 1 29except AttributeError: 30 print('AttributeError') 31