mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-09 13:32:20 +08:00
Remove the position_modifier from the parser.
This commit is contained in:
@@ -118,6 +118,7 @@ from io import StringIO
|
||||
from functools import reduce
|
||||
|
||||
import jedi
|
||||
from jedi import debug
|
||||
from jedi._compatibility import unicode, is_py3
|
||||
from jedi.parser import Parser, load_grammar
|
||||
from jedi.api.classes import Definition
|
||||
@@ -186,7 +187,7 @@ class IntegrationTestCase(object):
|
||||
for match in re.finditer('(?:[^ ]+)', correct):
|
||||
string = match.group(0)
|
||||
parser = Parser(load_grammar(), string, start_symbol='eval_input')
|
||||
parser.position_modifier.line = self.line_nr
|
||||
parser.get_root_node().move(self.line_nr)
|
||||
element = parser.get_parsed_node()
|
||||
element.parent = jedi.api.completion.get_user_scope(
|
||||
script._get_module(),
|
||||
@@ -198,6 +199,7 @@ class IntegrationTestCase(object):
|
||||
% (match.string, self.line_nr - 1))
|
||||
|
||||
should_be |= set(Definition(evaluator, r) for r in results)
|
||||
debug.dbg('Finished getting types', color='YELLOW')
|
||||
|
||||
# Because the objects have different ids, `repr`, then compare.
|
||||
should = set(comparison(r) for r in should_be)
|
||||
|
||||
@@ -200,7 +200,7 @@ def test_for_on_one_line(differ):
|
||||
|
||||
|
||||
def test_open_parentheses(differ):
|
||||
func = 'def func():\n a'
|
||||
func = 'def func():\n a\n'
|
||||
code = 'isinstance(\n\n' + func
|
||||
new_code = 'isinstance(\n' + func
|
||||
differ.initialize(code)
|
||||
@@ -208,10 +208,13 @@ def test_open_parentheses(differ):
|
||||
differ.parse(new_code, parsers=1, expect_error_leafs=True)
|
||||
|
||||
new_code = 'a = 1\n' + new_code
|
||||
differ.parse(new_code, parsers=2, expect_error_leafs=True)
|
||||
differ.parse(new_code, copies=1, parsers=1, expect_error_leafs=True)
|
||||
|
||||
differ.initialize(new_code)
|
||||
differ.parse('isinstance()\n' + func, parsers=2, copies=0)
|
||||
func += 'def other_func():\n pass\n'
|
||||
differ.initialize('isinstance(\n' + func)
|
||||
# Cannot copy all, because the prefix of the function is once a newline and
|
||||
# once not.
|
||||
differ.parse('isinstance()\n' + func, parsers=2, copies=1)
|
||||
|
||||
|
||||
def test_backslash(differ):
|
||||
|
||||
Reference in New Issue
Block a user