mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Merge branch 'master' into ts2
This commit is contained in:
@@ -209,7 +209,8 @@ def transform_path_to_dotted(sys_path, module_path):
|
|||||||
"""
|
"""
|
||||||
Returns the dotted path inside a sys.path as a list of names. e.g.
|
Returns the dotted path inside a sys.path as a list of names. e.g.
|
||||||
|
|
||||||
>>> transform_path_to_dotted(["/foo"], '/foo/bar/baz.py')
|
>>> from os.path import abspath
|
||||||
|
>>> transform_path_to_dotted([abspath("/foo")], abspath('/foo/bar/baz.py'))
|
||||||
(('bar', 'baz'), False)
|
(('bar', 'baz'), False)
|
||||||
|
|
||||||
Returns (None, False) if the path doesn't really resolve to anything.
|
Returns (None, False) if the path doesn't really resolve to anything.
|
||||||
|
|||||||
@@ -93,5 +93,5 @@ _s = ['/a', '/b', '/c/d/']
|
|||||||
(['/foo'], '/foo/bar.xyz', ('bar.xyz',), False),
|
(['/foo'], '/foo/bar.xyz', ('bar.xyz',), False),
|
||||||
])
|
])
|
||||||
def test_calculate_dotted_from_path(sys_path_, module_path, expected, is_package):
|
def test_calculate_dotted_from_path(sys_path_, module_path, expected, is_package):
|
||||||
assert sys_path.transform_path_to_dotted(sys_path_, module_path) \
|
# tranform_path_to_dotted expects normalized absolute paths.
|
||||||
== (expected, is_package)
|
sys_path_ = [os.path.abspath(path) for path in sys_path_]
|
||||||
|
|||||||
Reference in New Issue
Block a user