Differentiate between namespace and module as a type

Also fixed a bug related to implicit namespace contexts, fixes #1033.
This commit is contained in:
Dave Halter
2018-01-25 20:35:54 +01:00
parent 33c9d21e35
commit 04fba28d35
4 changed files with 12 additions and 9 deletions

View File

@@ -51,12 +51,15 @@ def test_implicit_nested_namespace_package(Script, environment):
if environment.version_info < (3, 4):
pytest.skip()
CODE = 'from implicit_nested_namespaces.namespace.pkg.module import CONST'
code = 'from implicit_nested_namespaces.namespace.pkg.module import CONST'
sys_path = [dirname(__file__)]
script = Script(sys_path=sys_path, source=CODE, line=1, column=61)
script = Script(sys_path=sys_path, source=code, line=1, column=61)
result = script.goto_definitions()
assert len(result) == 1
implicit_pkg, = Script(code, column=10, sys_path=sys_path).goto_definitions()
assert implicit_pkg.type == 'namespace'