mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 05:34:51 +08:00
Fix some issues.
This commit is contained in:
@@ -142,23 +142,15 @@ def test_started_lambda_stmt():
|
|||||||
assert m.children[0].type == 'error_node'
|
assert m.children[0].type == 'error_node'
|
||||||
|
|
||||||
|
|
||||||
def test_python2_octal():
|
def test_python2_octal(each_version):
|
||||||
module = parse('0660')
|
module = parse('0660', version=each_version)
|
||||||
first = module.children[0]
|
first = module.children[0]
|
||||||
if py_version >= 30:
|
if each_version.startswith('3'):
|
||||||
assert first.type == 'error_node'
|
assert first.type == 'error_node'
|
||||||
else:
|
else:
|
||||||
assert first.type == 'number'
|
assert first.type == 'number'
|
||||||
|
|
||||||
|
|
||||||
def test_python3_octal():
|
|
||||||
module = parse('0o660')
|
|
||||||
if py_version >= 30:
|
|
||||||
assert module.children[0].type == 'number'
|
|
||||||
else:
|
|
||||||
assert module.children[0].type == 'error_node'
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('code', ['foo "', 'foo """\n', 'foo """\nbar'])
|
@pytest.mark.parametrize('code', ['foo "', 'foo """\n', 'foo """\nbar'])
|
||||||
def test_open_string_literal(code):
|
def test_open_string_literal(code):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class TestsFunctionAndLambdaParsing(object):
|
|||||||
|
|
||||||
@pytest.fixture(params=FIXTURES)
|
@pytest.fixture(params=FIXTURES)
|
||||||
def node(self, request):
|
def node(self, request):
|
||||||
parsed = parse(dedent(request.param[0]))
|
parsed = parse(dedent(request.param[0]), version='3.5')
|
||||||
request.keywords['expected'] = request.param[1]
|
request.keywords['expected'] = request.param[1]
|
||||||
child = parsed.children[0]
|
child = parsed.children[0]
|
||||||
if child.type == 'simple_stmt':
|
if child.type == 'simple_stmt':
|
||||||
@@ -61,10 +61,11 @@ class TestsFunctionAndLambdaParsing(object):
|
|||||||
assert node.annotation.value == expected_annotation
|
assert node.annotation.value == expected_annotation
|
||||||
|
|
||||||
|
|
||||||
def test_end_pos_line():
|
def test_end_pos_line(each_version):
|
||||||
# jedi issue #150
|
# jedi issue #150
|
||||||
s = "x()\nx( )\nx( )\nx ( )\n"
|
s = "x()\nx( )\nx( )\nx ( )\n"
|
||||||
module = parse(s)
|
|
||||||
|
module = parse(s, version=each_version)
|
||||||
for i, simple_stmt in enumerate(module.children[:-1]):
|
for i, simple_stmt in enumerate(module.children[:-1]):
|
||||||
expr_stmt = simple_stmt.children[0]
|
expr_stmt = simple_stmt.children[0]
|
||||||
assert expr_stmt.end_pos == (i + 1, i + 3)
|
assert expr_stmt.end_pos == (i + 1, i + 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user