]> granicus.if.org Git - python/commitdiff
add grammar tests for nonlocal
authorBenjamin Peterson <benjamin@python.org>
Fri, 24 Oct 2008 22:16:39 +0000 (22:16 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 24 Oct 2008 22:16:39 +0000 (22:16 +0000)
Lib/test/test_grammar.py

index 9a8846307ecb4fd6839f5eda6f21236024f14e08..eadf1db7ab3c283f355d79dc8309d90f8c83163c 100644 (file)
@@ -485,6 +485,14 @@ class GrammarTests(unittest.TestCase):
         global a, b
         global one, two, three, four, five, six, seven, eight, nine, ten
 
+    def testNonlocal(self):
+        # 'nonlocal' NAME (',' NAME)*
+        x = 0
+        y = 0
+        def f():
+            nonlocal x
+            nonlocal x, y
+
     def testAssert(self):
         # assert_stmt: 'assert' test [',' test]
         assert 1