mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-22 05:11:25 +08:00
fix call signatures
This commit is contained in:
@@ -518,7 +518,8 @@ class Script(object):
|
|||||||
debug.speed('func_call followed')
|
debug.speed('func_call followed')
|
||||||
|
|
||||||
return [classes.CallDef(o, index, call) for o in origins
|
return [classes.CallDef(o, index, call) for o in origins
|
||||||
if o.isinstance(er.Function, er.Instance, er.Class)]
|
if o.isinstance(er.Function, er.Instance, er.Class)
|
||||||
|
or isinstance(o, compiled.PyObject) and o.type() != 'module']
|
||||||
|
|
||||||
def _func_call_and_param_index(self):
|
def _func_call_and_param_index(self):
|
||||||
debug.speed('func_call start')
|
debug.speed('func_call start')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class TestCallSignatures(TestCase):
|
|||||||
assert signatures[0].call_name == expected_name
|
assert signatures[0].call_name == expected_name
|
||||||
assert signatures[0].index == expected_index
|
assert signatures[0].index == expected_index
|
||||||
|
|
||||||
def test_call_signatures(self):
|
def test_simple(self):
|
||||||
def run(source, name, index=0, column=None, line=1):
|
def run(source, name, index=0, column=None, line=1):
|
||||||
self._run(source, name, index, line, column)
|
self._run(source, name, index, line, column)
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class TestCallSignatures(TestCase):
|
|||||||
"func(alpha='101',"
|
"func(alpha='101',"
|
||||||
run(s, 'func', 0, column=13, line=2)
|
run(s, 'func', 0, column=13, line=2)
|
||||||
|
|
||||||
def test_function_definition_complex(self):
|
def test_complex(self):
|
||||||
s = """
|
s = """
|
||||||
def abc(a,b):
|
def abc(a,b):
|
||||||
pass
|
pass
|
||||||
@@ -106,7 +106,7 @@ class TestCallSignatures(TestCase):
|
|||||||
# just don't throw an exception (if numpy doesn't exist, just ignore it)
|
# just don't throw an exception (if numpy doesn't exist, just ignore it)
|
||||||
assert Script(s).call_signatures() == []
|
assert Script(s).call_signatures() == []
|
||||||
|
|
||||||
def test_function_definition_empty_paren_pre_space(self):
|
def test_call_signatures_empty_parentheses_pre_space(self):
|
||||||
s = textwrap.dedent("""\
|
s = textwrap.dedent("""\
|
||||||
def f(a, b):
|
def f(a, b):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user