mirror of
https://github.com/micropython/micropython.git
synced 2026-05-01 21:30:14 +02:00
7373cbba6b
Signed-off-by: Damien George <damien@micropython.org>
19 lines
494 B
Python
19 lines
494 B
Python
# test errors with import *
|
|
|
|
if not hasattr(object, "__init__"):
|
|
# target doesn't have MICROPY_CPYTHON_COMPAT enabled, so doesn't check for "import *"
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
# '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")
|