mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-15 00:16:44 +08:00
5
test/test_api/simple_import/__init__.py
Normal file
5
test/test_api/simple_import/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from simple_import import module
|
||||
|
||||
|
||||
def in_function():
|
||||
from simple_import import module2
|
||||
0
test/test_api/simple_import/module.py
Normal file
0
test/test_api/simple_import/module.py
Normal file
0
test/test_api/simple_import/module2.py
Normal file
0
test/test_api/simple_import/module2.py
Normal file
@@ -2,6 +2,7 @@
|
||||
Test all things related to the ``jedi.api`` module.
|
||||
"""
|
||||
|
||||
import os
|
||||
from textwrap import dedent
|
||||
|
||||
from jedi import api
|
||||
@@ -205,3 +206,16 @@ def test_goto_assignments_follow_imports():
|
||||
|
||||
definition, = script.goto_assignments()
|
||||
assert (definition.line, definition.column) == start_pos
|
||||
|
||||
|
||||
def test_goto_module():
|
||||
def check(line, expected):
|
||||
script = api.Script(path=path, line=line)
|
||||
module, = script.goto_assignments()
|
||||
assert module.module_path == expected
|
||||
|
||||
base_path = os.path.join(os.path.dirname(__file__), 'simple_import')
|
||||
path = os.path.join(base_path, '__init__.py')
|
||||
|
||||
check(1, os.path.join(base_path, 'module.py'))
|
||||
check(5, os.path.join(base_path, 'module2.py'))
|
||||
|
||||
Reference in New Issue
Block a user