Skip to content

Commit

Permalink
Fix instance docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
micbou committed Jul 12, 2017
1 parent 9fb7fb6 commit f7fbf41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions jedi/evaluate/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, evaluator, parent_context, class_context, var_args):
super(AbstractInstanceContext, self).__init__(evaluator, parent_context)
# Generated instances are classes that are just generated by self
# (No var_args) used.
self.tree_node = class_context.tree_node
self.class_context = class_context
self.var_args = var_args

Expand Down
15 changes: 15 additions & 0 deletions test/test_evaluate/test_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ def func():
func""").goto_definitions()
self.assertEqual(defs[0].raw_doc, 'Docstring 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')
def test_attribute_docstring(self):
defs = jedi.Script("""
Expand Down

0 comments on commit f7fbf41

Please sign in to comment.