1
0
forked from VimPlug/jedi

Make sure that a goto on stubs even without the implementation is possible

This commit is contained in:
Dave Halter
2019-12-15 18:00:09 +01:00
parent 6e2a76feb9
commit 9d35adda02
2 changed files with 18 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
from os.path import join
import os
from test.helpers import root_dir
from jedi.api.project import Project
from jedi.inference.gradual.conversion import convert_names
@@ -21,3 +23,18 @@ def test_sqlite3_conversion(Script):
assert d.full_name == 'sqlite3.Connection'
v, = d._name.infer()
assert v.is_compiled()
def test_conversion_of_stub_only(Script):
project = Project(os.path.join(root_dir, 'test', 'completion', 'stub_folder'))
code = 'import stub_only; stub_only.in_stub_only'
d1, = Script(code, _project=project).goto_assignments()
assert d1.is_stub()
script = Script(path=d1.module_path, line=d1.line, column=d1.column, _project=project)
d2, = script.goto_assignments()
assert d2.is_stub()
assert d2.module_path == d1.module_path
assert d2.line == d1.line
assert d2.column == d1.column
assert d2.name == 'in_stub_only'