1# test errors from bad function calls 2 3# function doesn't take keyword args 4try: 5 [].append(x=1) 6except TypeError: 7 print('TypeError') 8 9# function with variable number of positional args given too few 10try: 11 round() 12except TypeError: 13 print('TypeError') 14 15# function with variable number of positional args given too many 16try: 17 round(1, 2, 3) 18except TypeError: 19 print('TypeError') 20 21# function with fixed number of positional args given wrong number 22try: 23 [].append(1, 2) 24except TypeError: 25 print('TypeError') 26 27# function with keyword args given extra positional args 28try: 29 [].sort(1) 30except TypeError: 31 print('TypeError') 32 33# function with keyword args given extra keyword args 34try: 35 [].sort(noexist=1) 36except TypeError: 37 print('TypeError') 38 39# kw given for positional, but a different positional is missing 40try: 41 def f(x, y): pass 42 f(x=1) 43except TypeError: 44 print('TypeError') 45