mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Fix the builtin docstring issue that we've had. Fixes #859.
This commit is contained in:
@@ -701,6 +701,12 @@ class _Help(object):
|
|||||||
|
|
||||||
@memoize_method
|
@memoize_method
|
||||||
def _get_node(self, fast):
|
def _get_node(self, fast):
|
||||||
|
if isinstance(self._name, (compiled.CompiledContextName, compiled.CompiledName)):
|
||||||
|
followed = self._name.infer()
|
||||||
|
if followed:
|
||||||
|
return next(iter(followed))
|
||||||
|
return None
|
||||||
|
|
||||||
if self._name.api_type == 'module' and not fast:
|
if self._name.api_type == 'module' and not fast:
|
||||||
followed = self._name.infer()
|
followed = self._name.infer()
|
||||||
if followed:
|
if followed:
|
||||||
|
|||||||
@@ -83,3 +83,9 @@ def test_method_completion():
|
|||||||
else:
|
else:
|
||||||
result = ['__func__']
|
result = ['__func__']
|
||||||
assert [c.name for c in Script(code).completions()] == result
|
assert [c.name for c in Script(code).completions()] == result
|
||||||
|
|
||||||
|
|
||||||
|
def test_time_docstring():
|
||||||
|
import time
|
||||||
|
comp, = Script('import time\ntime.sleep').completions()
|
||||||
|
assert comp.docstring() == time.sleep.__doc__
|
||||||
|
|||||||
Reference in New Issue
Block a user