Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: f8cdb5c56f6a14b62ffb3201de45f586fe3a6500 authored by cvs2svn on 02 February 2001, 21:24:51 UTC
This commit was manufactured by cvs2svn to create tag 'r21a2'.
Tip revision: f8cdb5c
test_compile.py
from test_support import verbose, TestFailed

if verbose:
    print 'Running tests on argument handling'

try:
    exec('def f(a, a): pass')
    raise TestFailed, "duplicate arguments"
except SyntaxError:
    pass

try:
    exec('def f(a = 0, a = 1): pass')
    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
back to top