forked from VimPlug/jedi
additional get_in_function_call tests
This commit is contained in:
@@ -414,11 +414,11 @@ def _get_in_function_call(module, pos):
|
|||||||
if s.execution is not None:
|
if s.execution is not None:
|
||||||
if s.execution.start_pos <= pos:
|
if s.execution.start_pos <= pos:
|
||||||
call = s
|
call = s
|
||||||
|
c, index = scan_array_for_pos(s.execution, pos)
|
||||||
|
if c is not None:
|
||||||
|
call = c
|
||||||
else:
|
else:
|
||||||
return call, index
|
return call, index
|
||||||
c, index = scan_array_for_pos(s.execution, pos)
|
|
||||||
if c is not None:
|
|
||||||
call = c
|
|
||||||
s = s.next
|
s = s.next
|
||||||
return call, index
|
return call, index
|
||||||
|
|
||||||
|
|||||||
@@ -108,12 +108,15 @@ class TestRegression(unittest.TestCase):
|
|||||||
def test_get_in_function_call(self):
|
def test_get_in_function_call(self):
|
||||||
s = "isinstance(a, abs("
|
s = "isinstance(a, abs("
|
||||||
s2 = "isinstance(), "
|
s2 = "isinstance(), "
|
||||||
print
|
|
||||||
check = lambda call_def, index: call_def and call_def.index == index
|
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,11)), 0)
|
||||||
assert check(self.get_in_function_call(s, (1,14)), 1)
|
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,15)), 1)
|
||||||
assert check(self.get_in_function_call(s, (1,18)), 0)
|
assert check(self.get_in_function_call(s, (1,18)), 0)
|
||||||
|
|
||||||
|
#assert check(self.get_in_function_call(s2, (1,11)), 0) # TODO uncomment
|
||||||
|
assert self.get_in_function_call(s2, (1,12)) is None
|
||||||
assert self.get_in_function_call(s2) is None
|
assert self.get_in_function_call(s2) is None
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user