forked from VimPlug/jedi
Fix some tests
This commit is contained in:
@@ -15,6 +15,7 @@ from jedi.evaluate import compiled
|
||||
from jedi.evaluate.imports import ImportName
|
||||
from jedi.evaluate.context import instance
|
||||
from jedi.evaluate.context import ClassContext, FunctionExecutionContext
|
||||
from jedi.plugins.typeshed import StubOnlyModuleContext
|
||||
from jedi.api.keywords import KeywordName
|
||||
|
||||
|
||||
@@ -203,6 +204,10 @@ class BaseDefinition(object):
|
||||
|
||||
def in_builtin_module(self):
|
||||
"""Whether this is a builtin module."""
|
||||
print(self._module)
|
||||
if isinstance(self._module, StubOnlyModuleContext):
|
||||
return any(isinstance(context, compiled.CompiledObject)
|
||||
for context in self._module.non_stub_context_set)
|
||||
return isinstance(self._module, compiled.CompiledObject)
|
||||
|
||||
@property
|
||||
|
||||
@@ -255,7 +255,6 @@ class TypeAlias(object):
|
||||
# There should only be one, because it's code that we control.
|
||||
assert len(classes) == 1, classes
|
||||
cls = next(iter(classes))
|
||||
assert isinstance(cls, ClassContext), cls
|
||||
return cls
|
||||
|
||||
|
||||
|
||||
@@ -357,10 +357,10 @@ class StubFunctionContext(_MixedStubContextMixin, FunctionContext):
|
||||
class StubOnlyModuleContext(ModuleContext):
|
||||
def __init__(self, non_stub_context_set, *args, **kwargs):
|
||||
super(StubOnlyModuleContext, self).__init__(*args, **kwargs)
|
||||
self._non_stub_context_set = non_stub_context_set
|
||||
self.non_stub_context_set = non_stub_context_set
|
||||
|
||||
def _get_first_non_stub_filters(self):
|
||||
for context in self._non_stub_context_set:
|
||||
for context in self.non_stub_context_set:
|
||||
yield next(context.get_filters(search_global=False))
|
||||
|
||||
def get_filters(self, search_global, until_position=None,
|
||||
|
||||
Reference in New Issue
Block a user