]> granicus.if.org Git - python/commitdiff
add test for SyntaxError on
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 19 Jan 2001 03:25:56 +0000 (03:25 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 19 Jan 2001 03:25:56 +0000 (03:25 +0000)
    def f(a):
        global a

Lib/test/test_compile.py

index 8905864a91455eba973d863eac155e5fc6b413fc..dff775803868d96ecf1fb7b3879087d2298f1ebf 100644 (file)
@@ -1,7 +1,7 @@
 from test_support import verbose, TestFailed
 
 if verbose:
-    print 'Running test on duplicate arguments'
+    print 'Running tests on argument handling'
 
 try:
     exec('def f(a, a): pass')
@@ -14,3 +14,9 @@ try:
     raise TestFailed, "duplicate keyword arguments"
 except SyntaxError:
     pass
+
+try:
+    exec('def f(a): global a; a = 1')
+    raise TestFailed, "variable is global and local"
+except SyntaxError:
+    pass