circuitpython/tests/import/import_star_error.py
2021-05-03 14:01:18 -07:00

14 lines
328 B
Python

# test errors with import *
# 'import *' is not allowed in function scope
try:
exec("def foo(): from x import *")
except SyntaxError as er:
print("function", "SyntaxError")
# 'import *' is not allowed in class scope
try:
exec("class C: from x import *")
except SyntaxError as er:
print("class", "SyntaxError")