mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
return None on keywords for BaseDefinition.full_name, fixes #94
This commit is contained in:
@@ -139,6 +139,9 @@ class BaseDefinition(object):
|
|||||||
"""The path to a certain class/function, see #61."""
|
"""The path to a certain class/function, see #61."""
|
||||||
path = [unicode(p) for p in self.path]
|
path = [unicode(p) for p in self.path]
|
||||||
# TODO add further checks, the mapping should only occur on stdlib.
|
# TODO add further checks, the mapping should only occur on stdlib.
|
||||||
|
if not path:
|
||||||
|
return None # for keywords the path is empty
|
||||||
|
|
||||||
try:
|
try:
|
||||||
path[0] = self._mapping[path[0]]
|
path[0] = self._mapping[path[0]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ class TestFeature(Base):
|
|||||||
== 'os.path.join'
|
== 'os.path.join'
|
||||||
# issue #94
|
# issue #94
|
||||||
defs = self.get_def("""import json; json.load(""")
|
defs = self.get_def("""import json; json.load(""")
|
||||||
defs[0].full_name
|
assert defs[0].full_name is None
|
||||||
|
|
||||||
def test_full_name_builtin(self):
|
def test_full_name_builtin(self):
|
||||||
self.assertEqual(self.complete('type')[0].full_name, 'type')
|
self.assertEqual(self.complete('type')[0].full_name, 'type')
|
||||||
|
|||||||
Reference in New Issue
Block a user