mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
goto on import statement (only import) raised an error
This commit is contained in:
@@ -342,7 +342,8 @@ class Script(object):
|
||||
|
||||
:rtype: list of :class:`api_classes.Definition`
|
||||
"""
|
||||
d = [api_classes.Definition(d) for d in set(self._goto()[0])]
|
||||
d = [api_classes.Definition(d) for d in set(self._goto()[0])
|
||||
if not isinstance(d, imports.ImportPath._GlobalNamespace)]
|
||||
return self._sorted_defs(d)
|
||||
|
||||
def _goto(self, add_import_name=False):
|
||||
|
||||
@@ -314,14 +314,16 @@ class TestRegression(TestBase):
|
||||
types = [o.type for o in objs]
|
||||
assert 'import' not in types and 'class' in types
|
||||
|
||||
def test_keyword_definition_doc(self):
|
||||
def test_keyword(self):
|
||||
""" github jedi-vim issue #44 """
|
||||
defs = self.goto_definitions("print")
|
||||
assert [d.doc for d in defs]
|
||||
|
||||
defs = self.goto_definitions("import")
|
||||
assert len(defs) == 1
|
||||
assert [d.doc for d in defs]
|
||||
assert len(defs) == 1 and [1 for d in defs if d.doc]
|
||||
# unrelated to #44
|
||||
defs = self.goto_assignments("import")
|
||||
assert len(defs) == 0
|
||||
|
||||
def test_goto_following_on_imports(self):
|
||||
s = "import multiprocessing.dummy; multiprocessing.dummy"
|
||||
|
||||
Reference in New Issue
Block a user