forked from VimPlug/jedi
better care for aliases in imports in jedi-vim issue 8
This commit is contained in:
@@ -448,6 +448,8 @@ class Script(object):
|
|||||||
kill_count = -1
|
kill_count = -1
|
||||||
cur_name_part = None
|
cur_name_part = None
|
||||||
for i in import_names:
|
for i in import_names:
|
||||||
|
if user_stmt.alias == i:
|
||||||
|
continue
|
||||||
for name_part in i.names:
|
for name_part in i.names:
|
||||||
if name_part.end_pos >= self.pos:
|
if name_part.end_pos >= self.pos:
|
||||||
if not cur_name_part:
|
if not cur_name_part:
|
||||||
|
|||||||
@@ -106,13 +106,6 @@ class TestRegression(unittest.TestCase):
|
|||||||
assert 10 < len(self.complete("from . import", (1, 5))) < 30
|
assert 10 < len(self.complete("from . import", (1, 5))) < 30
|
||||||
assert 10 < len(self.complete("from . import classes", (1, 5))) < 30
|
assert 10 < len(self.complete("from . import classes", (1, 5))) < 30
|
||||||
|
|
||||||
def test_new(self):
|
|
||||||
""" This is just to try out things, removing or deleting it is ok. """
|
|
||||||
s = ("def abc(): pass\n"
|
|
||||||
"abc.d.a.abc.d"
|
|
||||||
)
|
|
||||||
api.Script(s, 2, 2, '/').related_names()
|
|
||||||
|
|
||||||
def test_get_in_function_call(self):
|
def test_get_in_function_call(self):
|
||||||
def check(call_def, name, index):
|
def check(call_def, name, index):
|
||||||
return call_def and call_def.call_name == name \
|
return call_def and call_def.call_name == name \
|
||||||
@@ -178,6 +171,12 @@ class TestRegression(unittest.TestCase):
|
|||||||
assert len(result) == 1
|
assert len(result) == 1
|
||||||
assert result[0].description == 'class int'
|
assert result[0].description == 'class int'
|
||||||
|
|
||||||
|
def test_named_import(self):
|
||||||
|
""" named import - jedi-vim issue #8 """
|
||||||
|
s = "import datetime as dt"
|
||||||
|
assert len(api.Script(s, 1, 19, '/').get_definition()) == 1
|
||||||
|
assert len(api.Script(s, 1, 10, '/').get_definition()) == 1
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user