Fix autoclass_content = "both" bug.

This commit is contained in:
Georg Brandl
2008-12-07 22:36:23 +01:00
parent 2320d582ab
commit 132086798a
3 changed files with 18 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
Release 0.5.1 (in development)
==============================
* Fix a bug in autodoc when documenting classes with the option.
``autoclass_content = "both"`` set.
* Don't crash on empty index entries, only emit a warning.
* Fix a typo in the search JavaScript code, leading to unusable

View File

@@ -244,7 +244,7 @@ class RstGenerator(object):
if content == 'init':
docstrings = [initdocstring]
else:
docstrings.append('\n\n' + initdocstring)
docstrings.append(initdocstring)
# the default is only the class docstring
# decode the docstrings using the module's source encoding

View File

@@ -215,11 +215,24 @@ def test_get_doc():
assert getdocl('class', 'C', C) == ['Class docstring', '', 'Init docstring']
class D:
"""Class docstring"""
def __init__(self):
"""Init docstring
Other
lines
"""
# Indentation is normalized for 'both'
assert getdocl('class', 'D', D) == ['Class docstring', '', 'Init docstring',
'', 'Other', ' lines']
class E:
def __init__(self):
"""Init docstring"""
# docstring processing by event handler
assert getdocl('class', 'bar', D) == ['Init docstring', '', '42']
assert getdocl('class', 'bar', E) == ['Init docstring', '', '42']
def test_docstring_processing_functions():