1# test errors from bad operations (unary, binary, etc) 2 3# unsupported unary operators 4try: 5 ~None 6except TypeError: 7 print('TypeError') 8try: 9 ~'' 10except TypeError: 11 print('TypeError') 12try: 13 ~[] 14except TypeError: 15 print('TypeError') 16 17# unsupported binary operators 18try: 19 False in True 20except TypeError: 21 print('TypeError') 22try: 23 1 * {} 24except TypeError: 25 print('TypeError') 26try: 27 1 in 1 28except TypeError: 29 print('TypeError') 30 31# unsupported subscription 32try: 33 1[0] 34except TypeError: 35 print('TypeError') 36try: 37 1[0] = 1 38except TypeError: 39 print('TypeError') 40try: 41 ''[''] 42except TypeError: 43 print('TypeError') 44try: 45 'a'[0] = 1 46except TypeError: 47 print('TypeError') 48try: 49 del 1[0] 50except TypeError: 51 print('TypeError') 52 53# not callable 54try: 55 1() 56except TypeError: 57 print('TypeError') 58 59# not an iterator 60try: 61 next(1) 62except TypeError: 63 print('TypeError') 64 65# must be an exception type 66try: 67 raise 1 68except TypeError: 69 print('TypeError') 70 71# no such name in import 72try: 73 from sys import youcannotimportmebecauseidontexist 74except ImportError: 75 print('ImportError') 76