mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
add test for namespaced packages
This commit is contained in:
0
test/test_evaluate/nested_namespaces/__init__.py
Normal file
0
test/test_evaluate/nested_namespaces/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
try:
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONST = 1
|
||||||
@@ -51,3 +51,15 @@ def test_namespace_package():
|
|||||||
completion = c
|
completion = c
|
||||||
solution = "statement: foo = '%s'" % solution
|
solution = "statement: foo = '%s'" % solution
|
||||||
assert completion.description == solution
|
assert completion.description == solution
|
||||||
|
|
||||||
|
|
||||||
|
def test_nested_namespace_package():
|
||||||
|
CODE = 'from nested_namespaces.namespace.pkg import CONST'
|
||||||
|
|
||||||
|
sys_path = [dirname(__file__)]
|
||||||
|
|
||||||
|
script = jedi.Script(sys_path=sys_path, source=CODE, line=1, column=45)
|
||||||
|
|
||||||
|
result = script.goto_definitions()
|
||||||
|
|
||||||
|
assert len(result) == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user