2019-09-20 03:16:34 -04:00
|
|
|
# test errors with import *
|
|
|
|
|
|
|
|
# 'import *' is not allowed in function scope
|
|
|
|
try:
|
2020-03-22 22:26:08 -04:00
|
|
|
exec("def foo(): from x import *")
|
2019-09-20 03:16:34 -04:00
|
|
|
except SyntaxError as er:
|
2020-03-22 22:26:08 -04:00
|
|
|
print("function", "SyntaxError")
|
2019-09-20 03:16:34 -04:00
|
|
|
|
|
|
|
# 'import *' is not allowed in class scope
|
|
|
|
try:
|
2020-03-22 22:26:08 -04:00
|
|
|
exec("class C: from x import *")
|
2019-09-20 03:16:34 -04:00
|
|
|
except SyntaxError as er:
|
2020-03-22 22:26:08 -04:00
|
|
|
print("class", "SyntaxError")
|