mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
fixed a problem with positions of modules/imports
This commit is contained in:
@@ -1193,7 +1193,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
|||||||
if isinstance(scope, Instance):
|
if isinstance(scope, Instance):
|
||||||
scope_generator = scope.scope_generator()
|
scope_generator = scope.scope_generator()
|
||||||
else:
|
else:
|
||||||
if isinstance(scope, Class):
|
if isinstance(scope, (Class, parsing.Module)):
|
||||||
# classes are only available directly via chaining?
|
# classes are only available directly via chaining?
|
||||||
# strange stuff...
|
# strange stuff...
|
||||||
names = scope.get_defined_names()
|
names = scope.get_defined_names()
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ class TestRegression(unittest.TestCase):
|
|||||||
assert check(self.get_in_function_call(s8), 'zip', 0)
|
assert check(self.get_in_function_call(s8), 'zip', 0)
|
||||||
assert check(self.get_in_function_call(s8, (1, 8)), 'str', 0)
|
assert check(self.get_in_function_call(s8, (1, 8)), 'str', 0)
|
||||||
|
|
||||||
|
s = "import time; abc = time; abc.sleep("
|
||||||
|
assert check(self.get_in_function_call(s), 'sleep', 0)
|
||||||
|
|
||||||
def test_add_dynamic_mods(self):
|
def test_add_dynamic_mods(self):
|
||||||
api.settings.additional_dynamic_modules = ['dynamic.py']
|
api.settings.additional_dynamic_modules = ['dynamic.py']
|
||||||
# Fictional module that defines a function.
|
# Fictional module that defines a function.
|
||||||
|
|||||||
Reference in New Issue
Block a user