mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix autoclass_content = "both" bug.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user