return None on keywords for BaseDefinition.full_name, fixes #94

This commit is contained in:
David Halter
2012-12-30 10:49:18 +01:00
parent 548fb64fd7
commit 71b50bdbd7
2 changed files with 4 additions and 1 deletions

View File

@@ -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:

View File

@@ -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')