Fix some compatibilty issues in the test suite for Python 2.7.

This commit is contained in:
Dave Halter
2015-02-09 14:15:25 +01:00
parent 28d3ba6c04
commit 07156b427c
2 changed files with 3 additions and 3 deletions

View File

@@ -92,7 +92,7 @@ def test_end_newlines():
line the parser needs. line the parser needs.
""" """
def test(source, end_pos): def test(source, end_pos):
module = Parser(load_grammar(), source).module module = Parser(load_grammar(), u(source)).module
assert module.get_code() == source assert module.get_code() == source
assert module.end_pos == end_pos assert module.end_pos == end_pos

View File

@@ -158,7 +158,7 @@ def test_error_correction_with():
def test_newline_positions(): def test_newline_positions():
endmarker = Parser(load_grammar(), 'a\n').module.children[-1] endmarker = Parser(load_grammar(), u('a\n')).module.children[-1]
assert endmarker.end_pos == (2, 0) assert endmarker.end_pos == (2, 0)
new_line = endmarker.get_previous() new_line = endmarker.get_previous()
assert new_line.start_pos == (1, 1) assert new_line.start_pos == (1, 1)
@@ -171,7 +171,7 @@ def test_end_pos_error_correction():
grammar needs it. However, they are removed again. We still want the right grammar needs it. However, they are removed again. We still want the right
end_pos, even if something breaks in the parser (error correction). end_pos, even if something breaks in the parser (error correction).
""" """
s = 'def x():\n .' s = u('def x():\n .')
m = Parser(load_grammar(), s).module m = Parser(load_grammar(), s).module
func = m.children[0] func = m.children[0]
assert func.type == 'funcdef' assert func.type == 'funcdef'