mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-22 04:08:28 +08:00
Remove the user_scope from the user_context module.
This commit is contained in:
@@ -188,7 +188,10 @@ class IntegrationTestCase(object):
|
||||
parser = Parser(load_grammar(), string, start_symbol='eval_input')
|
||||
parser.position_modifier.line = self.line_nr
|
||||
element = parser.get_parsed_node()
|
||||
element.parent = script._parser.user_scope()
|
||||
element.parent = jedi.api.completion.get_user_scope(
|
||||
script._get_module(),
|
||||
(self.line_nr, self.column)
|
||||
)
|
||||
results = evaluator.eval_element(element)
|
||||
if not results:
|
||||
raise Exception('Could not resolve %s on line %s'
|
||||
|
||||
@@ -4,7 +4,6 @@ import sys
|
||||
import jedi
|
||||
from jedi._compatibility import u, is_py3
|
||||
from jedi.parser import ParserWithRecovery, load_grammar
|
||||
from jedi.parser.user_context import UserContextParser
|
||||
from jedi.parser import tree as pt
|
||||
from textwrap import dedent
|
||||
|
||||
@@ -15,9 +14,10 @@ def test_user_statement_on_import():
|
||||
" time)")
|
||||
|
||||
for pos in [(2, 1), (2, 4)]:
|
||||
p = UserContextParser(load_grammar(), s, None, pos, lambda x: 1).user_stmt()
|
||||
assert isinstance(p, pt.Import)
|
||||
assert [str(n) for n in p.get_defined_names()] == ['time']
|
||||
p = ParserWithRecovery(load_grammar(), s)
|
||||
stmt = p.module.get_statement_for_position(pos)
|
||||
assert isinstance(stmt, pt.Import)
|
||||
assert [str(n) for n in stmt.get_defined_names()] == ['time']
|
||||
|
||||
|
||||
class TestCallAndName():
|
||||
|
||||
Reference in New Issue
Block a user