mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
@@ -197,7 +197,7 @@ def test_goto_following_on_imports():
|
||||
assert (g[0].line, g[0].column) != (0, 0)
|
||||
|
||||
|
||||
def test_after_from():
|
||||
def test_os_after_from():
|
||||
def check(source, result, column=None):
|
||||
completions = Script(source, column=column).completions()
|
||||
assert [c.name for c in completions] == result
|
||||
@@ -211,6 +211,24 @@ def test_after_from():
|
||||
check('from os \\\n', ['import'])
|
||||
|
||||
|
||||
def test_os_issues():
|
||||
def import_names(*args, **kwargs):
|
||||
return [d.name for d in jedi.Script(*args, **kwargs).completions()]
|
||||
|
||||
# Github issue #759
|
||||
s = 'import os, s'
|
||||
assert 'sys' in import_names(s)
|
||||
assert 'path' not in import_names(s, column=len(s) - 1)
|
||||
assert 'os' in import_names(s, column=len(s) - 3)
|
||||
|
||||
# Some more checks
|
||||
s = 'from os import path, e'
|
||||
assert 'environ' in import_names(s)
|
||||
assert 'json' not in import_names(s, column=len(s) - 1)
|
||||
assert 'environ' in import_names(s, column=len(s) - 1)
|
||||
assert 'path' in import_names(s, column=len(s) - 3)
|
||||
|
||||
|
||||
def test_path_issues():
|
||||
"""
|
||||
See pull request #684 for details.
|
||||
|
||||
Reference in New Issue
Block a user