summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_parser.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-04-29 21:18:31 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-04-29 21:18:31 (GMT)
commit407b3bd89b877c198bf9cdbf290ddb91b49910b5 (patch)
tree2e60f2c615ab3ce8176763ba281897035b4e865f /Lib/test/test_parser.py
parent2420d831582a5403d679b6383933112948d476fe (diff)
downloadcpython-407b3bd89b877c198bf9cdbf290ddb91b49910b5.zip
cpython-407b3bd89b877c198bf9cdbf290ddb91b49910b5.tar.gz
cpython-407b3bd89b877c198bf9cdbf290ddb91b49910b5.tar.bz2
Issue #14696: Fix parser module to understand 'nonlocal' declarations.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r--Lib/test/test_parser.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index 833d317..f6105fc 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -57,6 +57,16 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
" if (yield):\n"
" yield x\n")
+ def test_nonlocal_statement(self):
+ self.check_suite("def f():\n"
+ " x = 0\n"
+ " def g():\n"
+ " nonlocal x\n")
+ self.check_suite("def f():\n"
+ " x = y = 0\n"
+ " def g():\n"
+ " nonlocal x, y\n")
+
def test_expressions(self):
self.check_expr("foo(1)")
self.check_expr("[1, 2, 3]")