diff options
Diffstat (limited to 'tests/import')
| -rw-r--r-- | tests/import/import_star_error.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/import/import_star_error.py b/tests/import/import_star_error.py new file mode 100644 index 000000000..17e237b8c --- /dev/null +++ b/tests/import/import_star_error.py @@ -0,0 +1,13 @@ +# 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') |
