Skip to content

Commit f8cb4a5

Browse files
committed
Add test for nonlocal
1 parent 7695851 commit f8cb4a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/snippets/global_nonlocal.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def x():
5656
with assertRaises(SyntaxError):
5757
exec(src)
5858

59+
# Invalid syntax:
60+
src = """
61+
def a():
62+
nonlocal a
63+
"""
64+
65+
with assertRaises(SyntaxError):
66+
exec(src)
5967

6068
# class X:
6169
# nonlocal c

0 commit comments

Comments
 (0)