mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
@@ -161,9 +161,17 @@ class BaseDefinition(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if name.api_type == 'module':
|
if name.api_type == 'module':
|
||||||
module_context, = name.infer()
|
module_contexts = name.infer()
|
||||||
for n in reversed(module_context.py__name__().split('.')):
|
if module_contexts:
|
||||||
yield n
|
module_context, = module_contexts
|
||||||
|
for n in reversed(module_context.py__name__().split('.')):
|
||||||
|
yield n
|
||||||
|
else:
|
||||||
|
# We don't really know anything about the path here. This
|
||||||
|
# module is just an import that would lead in an
|
||||||
|
# ImportError. So simply return the name.
|
||||||
|
yield name.string_name
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
yield name.string_name
|
yield name.string_name
|
||||||
|
|
||||||
|
|||||||
@@ -96,3 +96,9 @@ def test_os_path():
|
|||||||
assert d.full_name == 'os.path.join'
|
assert d.full_name == 'os.path.join'
|
||||||
d, = jedi.Script('import os.p').completions()
|
d, = jedi.Script('import os.p').completions()
|
||||||
assert d.full_name == 'os.path'
|
assert d.full_name == 'os.path'
|
||||||
|
|
||||||
|
|
||||||
|
def test_os_issues():
|
||||||
|
"""Issue #873"""
|
||||||
|
c, = jedi.Script('import os\nos.nt''').completions()
|
||||||
|
assert c.full_name == 'nt'
|
||||||
|
|||||||
Reference in New Issue
Block a user