1# test errors from bad operations (unary, binary, etc) 2 3def test_exc(code, exc): 4 try: 5 exec(code) 6 print("no exception") 7 except exc: 8 print("right exception") 9 except: 10 print("wrong exception") 11 12# object with buffer protocol needed on rhs 13try: 14 (1 << 70) in 1 15except TypeError: 16 print('TypeError') 17