Fix for failing assertion on native modules Issue #1354 (#1370)

This commit is contained in:
Johannes-Maria Frank
2019-07-23 12:02:08 +01:00
committed by Dave Halter
parent 18eb7622ba
commit 02d16ac55c
3 changed files with 11 additions and 2 deletions

View File

@@ -52,5 +52,6 @@ Tobias Rzepka (@TobiasRzepka)
micbou (@micbou)
Dima Gerasimov (@karlicoss) <karlicoss@gmail.com>
Max Woerner Chase (@mwchase) <max.chase@gmail.com>
Johannes Maria Frank (@jmfrank63) <jmfrank63@gmail.com>
Note: (@user) means a github user name.

View File

@@ -40,7 +40,9 @@ def _stub_to_python_context_set(stub_context, ignore_compiled=False):
def _infer_from_stub(stub_module, qualified_names, ignore_compiled):
assert isinstance(stub_module, StubModuleContext), stub_module
from jedi.evaluate.compiled.mixed import MixedObject
assert isinstance(stub_module, StubModuleContext) or \
isinstance(stub_module, MixedObject), stub_module
non_stubs = stub_module.non_stub_context_set
if ignore_compiled:
non_stubs = non_stubs.filter(lambda c: not c.is_compiled())

View File

@@ -8,7 +8,7 @@ import pytest
import jedi
from jedi._compatibility import is_py3, py_version
from jedi.evaluate.compiled import mixed
from importlib import import_module
if py_version > 30:
def exec_(source, global_map):
@@ -439,3 +439,9 @@ def test__wrapped__():
c, = jedi.Interpreter('syslogs_to_df', [locals()]).completions()
# Apparently the function starts on the line where the decorator starts.
assert c.line == syslogs_to_df.__wrapped__.__code__.co_firstlineno + 1
@pytest.mark.parametrize('module_name', ['sys', 'time'])
def test_core_module_completes(module_name):
module = import_module(module_name)
assert jedi.Interpreter(module_name + '.\n', [locals()]).completions()