mirror of
https://github.com/python/cpython.git
synced 2025-12-11 11:31:05 +00:00
add test for SyntaxError on
def f(a):
global a
This commit is contained in:
parent
c862cf400f
commit
047e2c93e2
1 changed files with 7 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
from test_support import verbose, TestFailed
|
from test_support import verbose, TestFailed
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'Running test on duplicate arguments'
|
print 'Running tests on argument handling'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exec('def f(a, a): pass')
|
exec('def f(a, a): pass')
|
||||||
|
|
@ -14,3 +14,9 @@ try:
|
||||||
raise TestFailed, "duplicate keyword arguments"
|
raise TestFailed, "duplicate keyword arguments"
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
exec('def f(a): global a; a = 1')
|
||||||
|
raise TestFailed, "variable is global and local"
|
||||||
|
except SyntaxError:
|
||||||
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue