Some Python2.7 fixes.

This commit is contained in:
Dave Halter
2017-08-15 19:34:47 +02:00
parent 86aa185136
commit 476d5fb0d1
2 changed files with 6 additions and 6 deletions

View File

@@ -8,8 +8,8 @@ versions, file caching, round-trips and other stuff:
>>> expr = module.children[0]
>>> expr
PythonNode(arith_expr, [<Name: hello@1,0>, <Operator: +>, <Number: 1>])
>>> expr.get_code()
'hello + 1'
>>> print(expr.get_code())
hello + 1
>>> name = expr.children[0]
>>> name
<Name: hello@1,0>

View File

@@ -28,11 +28,11 @@ def _invalid_syntax(code, version=None, **kwargs):
def test_formfeed(each_py2_version):
s = """print 1\n\x0Cprint 2\n"""
s = u"""print 1\n\x0Cprint 2\n"""
t = _parse(s, each_py2_version)
assert t.children[0].children[0].type == 'print_stmt'
assert t.children[1].children[0].type == 'print_stmt'
s = """1\n\x0C\x0C2\n"""
s = u"""1\n\x0C\x0C2\n"""
t = _parse(s, each_py2_version)
@@ -214,7 +214,7 @@ def test_multiline_bytes_literals(each_version):
It's not possible to get the same result when using \xaa in Python 2/3,
because it's treated differently.
"""
s = """
s = u"""
md5test(b"\xaa" * 80,
(b"Test Using Larger Than Block-Size Key "
b"and Larger Than One Block-Size Data"),
@@ -243,7 +243,7 @@ def test_dict_unpacking(works_ge_py35):
def test_multiline_str_literals(each_version):
s = """
s = u"""
md5test("\xaa" * 80,
("Test Using Larger Than Block-Size Key "
"and Larger Than One Block-Size Data"),