forked from VimPlug/jedi
filter all non executables when used with call_signatures, fixes #240
This commit is contained in:
@@ -467,7 +467,8 @@ class Script(object):
|
|||||||
origins = cache.cache_function_definition(_callable, user_stmt)
|
origins = cache.cache_function_definition(_callable, user_stmt)
|
||||||
debug.speed('func_call followed')
|
debug.speed('func_call followed')
|
||||||
|
|
||||||
return [api_classes.CallDef(o, index, call) for o in origins]
|
return [api_classes.CallDef(o, index, call) for o in origins
|
||||||
|
if o.isinstance(er.Function, er.Instance, er.Class)]
|
||||||
|
|
||||||
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,6 +15,7 @@ import inspect
|
|||||||
from .base import TestBase, unittest, cwd_at
|
from .base import TestBase, unittest, cwd_at
|
||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
|
from jedi import Script
|
||||||
from jedi._compatibility import utf8, unicode, is_py33
|
from jedi._compatibility import utf8, unicode, is_py33
|
||||||
from jedi import api, parsing, common
|
from jedi import api, parsing, common
|
||||||
|
|
||||||
@@ -238,6 +239,12 @@ class TestRegression(TestBase):
|
|||||||
s = """import functools; test = getattr(functools, 'partial'); test("""
|
s = """import functools; test = getattr(functools, 'partial'); test("""
|
||||||
check(self.function_definition(s), 'partial', 0)
|
check(self.function_definition(s), 'partial', 0)
|
||||||
|
|
||||||
|
def test_call_signature_on_module(self):
|
||||||
|
"""github issue #240"""
|
||||||
|
s = 'import datetime; datetime('
|
||||||
|
# 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_function_definition_empty_paren_pre_space(self):
|
||||||
s = textwrap.dedent("""\
|
s = textwrap.dedent("""\
|
||||||
def f(a, b):
|
def f(a, b):
|
||||||
|
|||||||
Reference in New Issue
Block a user