mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Always cast pr to er in _follow_statements_imports
This commit is contained in:
@@ -23,5 +23,6 @@ srusskih (@srusskih)
|
||||
Steven Silvester (@blink1073)
|
||||
Colin Duquesnoy (@ColinDuquesnoy) <colin.duquesnoy@gmail.com>
|
||||
Jorgen Schaefer (@jorgenschaefer) <contact@jorgenschaefer.de>
|
||||
Fredrik Bergroth (@fbergroth)
|
||||
|
||||
Note: (@user) means a github user name.
|
||||
|
||||
@@ -307,11 +307,12 @@ class BaseDefinition(object):
|
||||
stripped = self._definition
|
||||
if isinstance(stripped, pr.Name):
|
||||
stripped = stripped.parent
|
||||
# We should probably work in `Finder._names_to_types` here.
|
||||
if isinstance(stripped, pr.Function):
|
||||
stripped = er.Function(self._evaluator, stripped)
|
||||
elif isinstance(stripped, pr.Class):
|
||||
stripped = er.Class(self._evaluator, stripped)
|
||||
|
||||
# We should probably work in `Finder._names_to_types` here.
|
||||
if isinstance(stripped, pr.Function):
|
||||
stripped = er.Function(self._evaluator, stripped)
|
||||
elif isinstance(stripped, pr.Class):
|
||||
stripped = er.Class(self._evaluator, stripped)
|
||||
|
||||
if stripped.isinstance(pr.Statement):
|
||||
return self._evaluator.eval_statement(stripped)
|
||||
|
||||
@@ -127,6 +127,11 @@ def test_completion_docstring():
|
||||
assert c.docstring(raw=True, fast=False) == cleandoc(Script.__doc__)
|
||||
|
||||
|
||||
def test_completion_params():
|
||||
c = Script('import string; string.capwords').completions()[0]
|
||||
assert [p.name for p in c.params] == ['s', 'sep']
|
||||
|
||||
|
||||
def test_signature_params():
|
||||
def check(defs):
|
||||
params = defs[0].params
|
||||
|
||||
Reference in New Issue
Block a user