1
0
forked from VimPlug/jedi

Fix conversion for contexts

This commit is contained in:
Dave Halter
2019-06-10 18:56:37 +02:00
parent 144aa97c00
commit 7f3e55df02
4 changed files with 30 additions and 23 deletions

View File

@@ -126,8 +126,7 @@ from jedi.api.classes import Definition
from jedi.api.completion import get_user_scope
from jedi import parser_utils
from jedi.api.environment import get_default_environment, get_system_environment
from jedi.evaluate.gradual.conversion import stub_to_python_context_set
from jedi.evaluate.base_context import ContextSet
from jedi.evaluate.gradual.conversion import convert_contexts
TEST_COMPLETIONS = 0
@@ -139,16 +138,6 @@ TEST_USAGES = 3
grammar36 = parso.load_grammar(version='3.6')
def try_stubs_to_python_context_set(stub_contexts, prefer_stub_to_compiled=False):
contexts = ContextSet.from_sets(
stub_to_python_context_set(stub_context, ignore_compiled=prefer_stub_to_compiled)
or ContextSet([stub_context])
for stub_context in stub_contexts
)
debug.dbg('Stubs to actual: %s to %s', stub_contexts, contexts)
return contexts
class IntegrationTestCase(object):
def __init__(self, test_type, correct, line_nr, column, start, line,
path=None, skip_version_info=None):
@@ -242,9 +231,8 @@ class IntegrationTestCase(object):
if user_context.api_type == 'function':
user_context = user_context.get_function_execution()
element.parent = user_context.tree_node
results = try_stubs_to_python_context_set(
results = convert_contexts(
evaluator.eval_element(user_context, element),
prefer_stub_to_compiled=True
)
if not results:
raise Exception('Could not resolve %s on line %s'