1
0
forked from VimPlug/jedi

well yeah give NamePart a get_code method after all, makes sense, because all the other parser representation objects have it.

This commit is contained in:
Dave Halter
2014-04-20 14:32:48 +02:00
parent 50c4b7bfd9
commit 81cc50e8b5
2 changed files with 8 additions and 0 deletions

View File

@@ -1396,6 +1396,9 @@ class NamePart(object):
def __repr__(self): def __repr__(self):
return "<%s: %s>" % (type(self).__name__, self._string) return "<%s: %s>" % (type(self).__name__, self._string)
def get_code(self):
return self._string
def get_parent_until(self, *args, **kwargs): def get_parent_until(self, *args, **kwargs):
return self.parent.get_parent_until(*args, **kwargs) return self.parent.get_parent_until(*args, **kwargs)

View File

@@ -127,3 +127,8 @@ def test_goto_definition_not_multiple():
a = A(1) a = A(1)
a''') a''')
assert len(api.Script(s).goto_definitions()) == 1 assert len(api.Script(s).goto_definitions()) == 1
def test_usage_description():
for u in api.Script('foo = ''; foo').usages():
assert u.description == 'foo'