forked from VimPlug/jedi
Fix instance docstring
This commit is contained in:
@@ -197,6 +197,11 @@ class CompiledInstance(AbstractInstanceContext):
|
|||||||
|
|
||||||
|
|
||||||
class TreeInstance(AbstractInstanceContext):
|
class TreeInstance(AbstractInstanceContext):
|
||||||
|
def __init__(self, evaluator, parent_context, class_context, var_args):
|
||||||
|
super(TreeInstance, self).__init__(evaluator, parent_context,
|
||||||
|
class_context, var_args)
|
||||||
|
self.tree_node = class_context.tree_node
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return filters.ContextName(self, self.class_context.name.tree_name)
|
return filters.ContextName(self, self.class_context.name.tree_name)
|
||||||
|
|||||||
@@ -22,6 +22,21 @@ class TestDocstring(unittest.TestCase):
|
|||||||
func""").goto_definitions()
|
func""").goto_definitions()
|
||||||
self.assertEqual(defs[0].docstring(), 'func()\n\nDocstring of `func`.')
|
self.assertEqual(defs[0].docstring(), 'func()\n\nDocstring of `func`.')
|
||||||
|
|
||||||
|
def test_class_doc(self):
|
||||||
|
defs = jedi.Script("""
|
||||||
|
class TestClass():
|
||||||
|
'''Docstring of `TestClass`.'''
|
||||||
|
TestClass""").goto_definitions()
|
||||||
|
self.assertEqual(defs[0].docstring(), 'Docstring of `TestClass`.')
|
||||||
|
|
||||||
|
def test_instance_doc(self):
|
||||||
|
defs = jedi.Script("""
|
||||||
|
class TestClass():
|
||||||
|
'''Docstring of `TestClass`.'''
|
||||||
|
tc = TestClass()
|
||||||
|
tc""").goto_definitions()
|
||||||
|
self.assertEqual(defs[0].docstring(), 'Docstring of `TestClass`.')
|
||||||
|
|
||||||
@unittest.skip('need evaluator class for that')
|
@unittest.skip('need evaluator class for that')
|
||||||
def test_attribute_docstring(self):
|
def test_attribute_docstring(self):
|
||||||
defs = jedi.Script("""
|
defs = jedi.Script("""
|
||||||
|
|||||||
Reference in New Issue
Block a user