diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 653b5d55..1ff32867 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -1396,6 +1396,9 @@ class NamePart(object): def __repr__(self): return "<%s: %s>" % (type(self).__name__, self._string) + def get_code(self): + return self._string + def get_parent_until(self, *args, **kwargs): return self.parent.get_parent_until(*args, **kwargs) diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index a32edd98..7890b8c5 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -127,3 +127,8 @@ def test_goto_definition_not_multiple(): a = A(1) a''') assert len(api.Script(s).goto_definitions()) == 1 + + +def test_usage_description(): + for u in api.Script('foo = ''; foo').usages(): + assert u.description == 'foo'