summaryrefslogtreecommitdiffstatshomepage
path: root/tests/import/import_star_error.py
blob: 9e1757b6ef5a23ba10bf94c2bf92a56d098957ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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")