From 476d5fb0d1cf44f7e1e51d91e1388649d93e29ed Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 15 Aug 2017 19:34:47 +0200 Subject: [PATCH] Some Python2.7 fixes. --- parso/__init__.py | 4 ++-- test/test_pgen2.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/parso/__init__.py b/parso/__init__.py index c56a79b..84a2534 100644 --- a/parso/__init__.py +++ b/parso/__init__.py @@ -8,8 +8,8 @@ versions, file caching, round-trips and other stuff: >>> expr = module.children[0] >>> expr PythonNode(arith_expr, [, , ]) ->>> expr.get_code() -'hello + 1' +>>> print(expr.get_code()) +hello + 1 >>> name = expr.children[0] >>> name diff --git a/test/test_pgen2.py b/test/test_pgen2.py index 9d2fabd..37b3d42 100644 --- a/test/test_pgen2.py +++ b/test/test_pgen2.py @@ -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"),