mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 10:37:52 +08:00
Implement goto_assignments(follow_imports=True). Fixes #382.
This commit is contained in:
@@ -164,3 +164,16 @@ def test_get_line_code():
|
||||
assert get_line_code(source, line=2) == line
|
||||
assert get_line_code(source, line=2, after=1) == line + '\nother_line'
|
||||
assert get_line_code(source, line=2, after=1, before=1) == source
|
||||
|
||||
|
||||
def test_goto_assignments_follow_imports():
|
||||
code = dedent("""
|
||||
import inspect
|
||||
inspect.isfunction""")
|
||||
definition, = api.Script(code, column=0).goto_assignments(follow_imports=True)
|
||||
assert 'inspect.py' in definition.module_path
|
||||
assert definition.start_pos == (1, 0)
|
||||
|
||||
definition, = api.Script(code).goto_assignments(follow_imports=True)
|
||||
assert 'inspect.py' in definition.module_path
|
||||
assert definition.start_pos > (1, 0)
|
||||
|
||||
@@ -153,8 +153,8 @@ class TestInterpreterAPI(TestCase):
|
||||
def foo(bar):
|
||||
pass
|
||||
|
||||
lambd = lambda x: 3
|
||||
lambd = lambda xyz: 3
|
||||
|
||||
self.check_interpreter_complete('foo(bar', locals(), ['bar'])
|
||||
# TODO we're not yet using the Python3.5 inspect.signature, yet.
|
||||
assert not jedi.Interpreter('lambd(x', [locals()]).completions()
|
||||
assert not jedi.Interpreter('lambd(xyz', [locals()]).completions()
|
||||
|
||||
Reference in New Issue
Block a user