mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Merge pull request #141 from tkf/attribute-docstring
Attribute docstring support
This commit is contained in:
@@ -352,6 +352,33 @@ class TestRegression(TestBase):
|
||||
assert 'start' in words
|
||||
|
||||
|
||||
class TestDocstring(TestBase):
|
||||
|
||||
def test_function_doc(self):
|
||||
defs = self.definition("""
|
||||
def func():
|
||||
'''Docstring of `func`.'''
|
||||
func""")
|
||||
self.assertEqual(defs[0].raw_doc, 'Docstring of `func`.')
|
||||
|
||||
def test_attribute_docstring(self):
|
||||
defs = self.definition("""
|
||||
x = None
|
||||
'''Docstring of `x`.'''
|
||||
x""")
|
||||
self.assertEqual(defs[0].raw_doc, 'Docstring of `x`.')
|
||||
|
||||
def test_multiple_docstrings(self):
|
||||
defs = self.definition("""
|
||||
def func():
|
||||
'''Original docstring.'''
|
||||
x = func
|
||||
'''Docstring of `x`.'''
|
||||
x""")
|
||||
docs = [d.raw_doc for d in defs]
|
||||
self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.'])
|
||||
|
||||
|
||||
class TestFeature(TestBase):
|
||||
def test_full_name(self):
|
||||
""" feature request #61"""
|
||||
|
||||
Reference in New Issue
Block a user