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