Skip to content

Commit

Permalink
- these don't need to be switched for py3k
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek committed Jul 8, 2012
1 parent 91b7e5f commit c520887
Showing 1 changed file with 4 additions and 37 deletions.
41 changes: 4 additions & 37 deletions test/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,22 @@ def test_locate_identifiers_3(self):
)

def test_locate_identifiers_4(self):
if util.py3k:
code = """
code = """
x = 5
(y, )
def mydef(mydefarg):
print("mda is", mydefarg)
"""
else:
code = """
x = 5
(y, )
def mydef(mydefarg):
print "mda is", mydefarg
"""
parsed = ast.PythonCode(code, **exception_kwargs)
eq_(parsed.undeclared_identifiers, set(['y']))
eq_(parsed.declared_identifiers, set(['mydef', 'x']))

def test_locate_identifiers_5(self):
if util.py3k:
code = """
code = """
try:
print(x)
except:
print(y)
"""
else:

code = """
try:
print x
except:
print y
"""
parsed = ast.PythonCode(code, **exception_kwargs)
eq_(parsed.undeclared_identifiers, set(['x', 'y']))
Expand All @@ -120,37 +103,21 @@ def foo():
parsed = ast.PythonCode(code, **exception_kwargs)
eq_(parsed.undeclared_identifiers, set(['bar']))

if util.py3k:
code = """
code = """
def lala(x, y):
return x, y, z
print(x)
"""
else:
code = """
def lala(x, y):
return x, y, z
print x
"""
parsed = ast.PythonCode(code, **exception_kwargs)
eq_(parsed.undeclared_identifiers, set(['z', 'x']))
eq_(parsed.declared_identifiers, set(['lala']))

if util.py3k:
code = """
code = """
def lala(x, y):
def hoho():
def bar():
z = 7
print(z)
"""
else:
code = """
def lala(x, y):
def hoho():
def bar():
z = 7
print z
"""
parsed = ast.PythonCode(code, **exception_kwargs)
eq_(parsed.undeclared_identifiers, set(['z']))
Expand Down

0 comments on commit c520887

Please sign in to comment.