mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-19 02:12:47 +08:00
showing function params working now on both sides, but not joined
This commit is contained in:
@@ -18,6 +18,11 @@ class TestRegression(unittest.TestCase):
|
||||
def complete(self, src, pos):
|
||||
return functions.complete(src, pos[0], pos[1], '')
|
||||
|
||||
def get_in_function_call(self, src, pos=None):
|
||||
if pos is None:
|
||||
pos = 1, len(src)
|
||||
return functions.get_in_function_call(src, pos[0], pos[1], '')
|
||||
|
||||
def test_get_definition_cursor(self):
|
||||
|
||||
s = ("class A():\n"
|
||||
@@ -100,6 +105,16 @@ class TestRegression(unittest.TestCase):
|
||||
)
|
||||
functions.related_names(s, 2, 2, '/')
|
||||
|
||||
def test_get_in_function_call(self):
|
||||
s = "isinstance(a, abs("
|
||||
s2 = "isinstance(), "
|
||||
print
|
||||
check = lambda call_def, index: call_def and call_def.index == index
|
||||
assert check(self.get_in_function_call(s, (1,11)), 0)
|
||||
assert check(self.get_in_function_call(s, (1,14)), 1)
|
||||
assert check(self.get_in_function_call(s, (1,15)), 1)
|
||||
assert check(self.get_in_function_call(s, (1,18)), 0)
|
||||
assert self.get_in_function_call(s2) is None
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -24,7 +24,8 @@ def run_completion_test(correct, source, line_nr, index, line, path):
|
||||
# lines start with 1 and column is just the last (makes no
|
||||
# difference for testing)
|
||||
try:
|
||||
completions = functions.complete(source, line_nr, index, path)
|
||||
completions, call_def = functions.complete(source, line_nr, index,
|
||||
path)
|
||||
#import cProfile as profile
|
||||
#profile.run('functions.complete("""%s""", %i, %i, "%s")'
|
||||
# % (source, line_nr, len(line), path))
|
||||
|
||||
Reference in New Issue
Block a user