PythonExtra/tests/import/import_star_error.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
328 B
Python
Raw Normal View History

# 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")