forked from VimPlug/jedi
Small full_name improvements.
This commit is contained in:
@@ -173,9 +173,7 @@ class BaseDefinition(object):
|
||||
par = self._definition
|
||||
while par is not None:
|
||||
if isinstance(par, pr.Import):
|
||||
path += par.from_names
|
||||
path += par.namespace_names
|
||||
if par.relative_count == 0:
|
||||
path += imports.ImportWrapper(self._evaluator, self._name).import_path
|
||||
break
|
||||
with common.ignored(AttributeError):
|
||||
path.insert(0, par.name)
|
||||
|
||||
@@ -27,16 +27,14 @@ class MixinTestFullName(object):
|
||||
def check(self, source, desired):
|
||||
script = jedi.Script(textwrap.dedent(source))
|
||||
definitions = getattr(script, type(self).operation)()
|
||||
assert len(definitions) == 1
|
||||
self.assertEqual(definitions[0].full_name, desired)
|
||||
|
||||
def test_os_path_join(self):
|
||||
self.check('import os; os.path.join', 'os.path.join')
|
||||
|
||||
def test_builtin(self):
|
||||
self.check('type', 'type')
|
||||
|
||||
def test_from_import(self):
|
||||
self.check('from os import path', 'os.path')
|
||||
self.check('TypeError', 'TypeError')
|
||||
|
||||
|
||||
class TestFullNameWithGotoDefinitions(MixinTestFullName, TestCase):
|
||||
@@ -49,6 +47,9 @@ class TestFullNameWithGotoDefinitions(MixinTestFullName, TestCase):
|
||||
any_re = re.compile('.*')
|
||||
any_re""", 're.RegexObject')
|
||||
|
||||
def test_from_import(self):
|
||||
self.check('from os import path', 'os.path')
|
||||
|
||||
|
||||
class TestFullNameWithCompletions(MixinTestFullName, TestCase):
|
||||
operation = 'completions'
|
||||
|
||||
Reference in New Issue
Block a user