mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
Fix some compatibilty issues in the test suite for Python 2.7.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user