mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Import priorities are wrong (__dict__ > files). Test for #536.
This commit is contained in:
@@ -1 +1,7 @@
|
||||
a = ''
|
||||
|
||||
from . import invisible_pkg
|
||||
|
||||
the_pkg = invisible_pkg
|
||||
|
||||
invisible_pkg = 1
|
||||
|
||||
@@ -110,6 +110,23 @@ def as_imports():
|
||||
#? int()
|
||||
bar.a
|
||||
|
||||
|
||||
def test_import_priorities():
|
||||
"""
|
||||
It's possible to overwrite import paths in an ``__init__.py`` file, by
|
||||
just assigining something there.
|
||||
|
||||
See also #536.
|
||||
"""
|
||||
from import_tree import the_pkg, invisible_pkg
|
||||
# TODO currently not enabled, later we should actually fix this.
|
||||
##? int()
|
||||
invisible_pkg
|
||||
# The renamed invisible_pkg in that module (look at ``__init__.py``!)
|
||||
#? float()
|
||||
the_pkg.foo
|
||||
|
||||
|
||||
# -----------------
|
||||
# std lib modules
|
||||
# -----------------
|
||||
|
||||
@@ -65,7 +65,7 @@ import datetime.date
|
||||
from import_tree.pkg import pkg
|
||||
#? 22 ['mod1']
|
||||
from import_tree.pkg. import mod1
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'recurse_class1', 'recurse_class2']
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'recurse_class1', 'recurse_class2', 'invisible_pkg']
|
||||
from import_tree. import pkg
|
||||
|
||||
#? 18 ['pkg']
|
||||
|
||||
Reference in New Issue
Block a user