fixed a problem with positions of modules/imports

This commit is contained in:
David Halter
2012-10-14 14:07:31 +02:00
parent 80ec5e0e9d
commit 7fda97767e
2 changed files with 4 additions and 1 deletions

View File

@@ -1193,7 +1193,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
if isinstance(scope, Instance):
scope_generator = scope.scope_generator()
else:
if isinstance(scope, Class):
if isinstance(scope, (Class, parsing.Module)):
# classes are only available directly via chaining?
# strange stuff...
names = scope.get_defined_names()

View File

@@ -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, (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):
api.settings.additional_dynamic_modules = ['dynamic.py']
# Fictional module that defines a function.