forked from VimPlug/jedi
Stubs should not become stubs again in the conversion function, fixes #1475
This commit is contained in:
@@ -73,6 +73,12 @@ def _try_stub_to_python_names(names, prefer_stub_to_compiled=False):
|
|||||||
converted_names = converted.goto(name.get_public_name())
|
converted_names = converted.goto(name.get_public_name())
|
||||||
if converted_names:
|
if converted_names:
|
||||||
for n in converted_names:
|
for n in converted_names:
|
||||||
|
if n.get_root_context().is_stub():
|
||||||
|
# If it's a stub again, it means we're going in
|
||||||
|
# a circle. Probably some imports make it a
|
||||||
|
# stub again.
|
||||||
|
yield name
|
||||||
|
else:
|
||||||
yield n
|
yield n
|
||||||
continue
|
continue
|
||||||
yield name
|
yield name
|
||||||
|
|||||||
@@ -431,8 +431,9 @@ def test_completion_cache(Script, module_injector):
|
|||||||
assert cls.docstring() == 'foo()\n\ndoc2'
|
assert cls.docstring() == 'foo()\n\ndoc2'
|
||||||
|
|
||||||
|
|
||||||
def test_typing_module_completions(Script):
|
@pytest.mark.parametrize('module', ['typing', 'os'])
|
||||||
for c in Script('import typing; typing.').completions():
|
def test_module_completions(Script, module):
|
||||||
|
for c in Script('import {module}; {module}.'.format(module=module)).completions():
|
||||||
# Just make sure that there are no errors
|
# Just make sure that there are no errors
|
||||||
c.type
|
c.type
|
||||||
c.docstring()
|
c.docstring()
|
||||||
|
|||||||
@@ -62,3 +62,11 @@ def test_goto_import(Script, skip_pre_python35):
|
|||||||
assert d.is_stub()
|
assert d.is_stub()
|
||||||
d, = Script(code).goto()
|
d, = Script(code).goto()
|
||||||
assert not d.is_stub()
|
assert not d.is_stub()
|
||||||
|
|
||||||
|
|
||||||
|
def test_os_stat_result(Script):
|
||||||
|
d, = Script('import os; os.stat_result').goto()
|
||||||
|
assert d.is_stub()
|
||||||
|
n = d._name
|
||||||
|
# This should not be a different stub name
|
||||||
|
assert convert_names([n]) == [n]
|
||||||
|
|||||||
Reference in New Issue
Block a user