mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 18:05:21 +08:00
Move get_module_contexts_containing_name to the references module
This commit is contained in:
5
test/completion/import_tree/references.py
Normal file
5
test/completion/import_tree/references.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from ..usages import usage_definition
|
||||
|
||||
|
||||
def x():
|
||||
usage_definition()
|
||||
@@ -75,7 +75,7 @@ from import_tree.pkg.mod1 import not_existant, # whitespace before
|
||||
from import_tree.pkg.mod1 import not_existant,
|
||||
#? 22 ['mod1', 'base']
|
||||
from import_tree.pkg. import mod1
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'classes', 'globals', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'references', 'rename1', 'rename2', 'classes', 'globals', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
|
||||
from import_tree. import pkg
|
||||
|
||||
#? 18 ['pkg']
|
||||
|
||||
@@ -367,3 +367,13 @@ in_python
|
||||
from stub_folder.with_stub_folder.nested_with_stub import in_both
|
||||
#< ('stub_folder.with_stub_folder.nested_with_stub', 2, 0), ('stub:stub_folder.with_stub_folder.nested_with_stub', 2, 0), ('stubs', 66, 17), (-2, 58), (0, 0)
|
||||
in_both
|
||||
|
||||
# -----------------
|
||||
# across directories
|
||||
# -----------------
|
||||
|
||||
#< 8 (0, 0), (3, 4), ('import_tree.references', 1, 21), ('import_tree.references', 5, 4)
|
||||
usage_definition = 1
|
||||
if False:
|
||||
#< 8 (-3, 0), (0, 4), ('import_tree.references', 1, 21), ('import_tree.references', 5, 4)
|
||||
usage_definition()
|
||||
|
||||
@@ -13,6 +13,7 @@ from jedi.inference import compiled
|
||||
from jedi.inference import imports
|
||||
from jedi.api.project import Project
|
||||
from jedi.inference.gradual.conversion import _stub_to_python_value_set
|
||||
from jedi.inference.references import get_module_contexts_containing_name
|
||||
from ..helpers import cwd_at, get_example_dir, test_dir, root_dir
|
||||
|
||||
THIS_DIR = os.path.dirname(__file__)
|
||||
@@ -319,7 +320,7 @@ def test_get_modules_containing_name(inference_state, path, goal, is_package):
|
||||
)
|
||||
assert module
|
||||
module_context = module.as_context()
|
||||
input_module, found_module = imports.get_module_contexts_containing_name(
|
||||
input_module, found_module = get_module_contexts_containing_name(
|
||||
inference_state,
|
||||
[module_context],
|
||||
'string_that_only_exists_here'
|
||||
|
||||
Reference in New Issue
Block a user