From bd239446f547107182e74172d558a1fa48e159fe Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 12 Jan 2014 02:42:00 +0100 Subject: [PATCH] fix call signatures --- jedi/api/__init__.py | 3 ++- test/test_call_signatures.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 25b0d836..1d0eb873 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -518,7 +518,8 @@ class Script(object): debug.speed('func_call followed') 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): debug.speed('func_call start') diff --git a/test/test_call_signatures.py b/test/test_call_signatures.py index 9505b3ae..6fe99a9e 100644 --- a/test/test_call_signatures.py +++ b/test/test_call_signatures.py @@ -15,7 +15,7 @@ class TestCallSignatures(TestCase): assert signatures[0].call_name == expected_name 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): self._run(source, name, index, line, column) @@ -72,7 +72,7 @@ class TestCallSignatures(TestCase): "func(alpha='101'," run(s, 'func', 0, column=13, line=2) - def test_function_definition_complex(self): + def test_complex(self): s = """ def abc(a,b): pass @@ -106,7 +106,7 @@ class TestCallSignatures(TestCase): # just don't throw an exception (if numpy doesn't exist, just ignore it) 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("""\ def f(a, b): pass