diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-04-29 21:18:31 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-04-29 21:18:31 (GMT) |
commit | 407b3bd89b877c198bf9cdbf290ddb91b49910b5 (patch) | |
tree | 2e60f2c615ab3ce8176763ba281897035b4e865f /Lib/test/test_parser.py | |
parent | 2420d831582a5403d679b6383933112948d476fe (diff) | |
download | cpython-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.py | 10 |
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]") |