Merge pull request #141 from tkf/attribute-docstring

Attribute docstring support
This commit is contained in:
David Halter
2013-03-10 13:23:47 -07:00
4 changed files with 55 additions and 1 deletions

View File

@@ -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"""