You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
328 B
13 lines
328 B
# 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')
|
|
|