diff options
author | shimizukawa <shimizukawa@gmail.com> | 2013-12-09 10:55:51 +0000 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2013-12-09 10:55:51 +0000 |
commit | cc06d3e8033786bef0661f9c54e1795d5e678fae (patch) | |
tree | a9b34ee91a221397554dc7594c6842e50c6fdeff /tests | |
parent | 55d8f94240637cd111b10ec4fc150e6564524d67 (diff) | |
download | sphinx-cc06d3e8033786bef0661f9c54e1795d5e678fae.tar.gz |
Fix: autodoc class __init__ override not removed from docstring. Closes #1138
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_autodoc.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 1931c0d0..63c341f1 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -301,6 +301,39 @@ def test_get_doc(): assert getdocl('class', D) == ['Class docstring', '', 'Init docstring', '', 'Other', ' lines'] + #__init__ have signature at first line of docstring + class E: + """Class docstring""" + def __init__(self, *args, **kw): + """ + __init__(a1, a2, kw1=True, kw2=False) + + Init docstring + """ + + # signature line in the docstring will be kept when + # autodoc_docstring_signature == False + directive.env.config.autodoc_docstring_signature = False + directive.env.config.autoclass_content = 'class' + assert getdocl('class', E) == ['Class docstring'] + directive.env.config.autoclass_content = 'init' + assert getdocl('class', E) == ['__init__(a1, a2, kw1=True, kw2=False)', + '', 'Init docstring'] + directive.env.config.autoclass_content = 'both' + assert getdocl('class', E) == ['Class docstring', '', + '__init__(a1, a2, kw1=True, kw2=False)', + '', 'Init docstring'] + + # signature line in the docstring will be removed when + # autodoc_docstring_signature == True + directive.env.config.autodoc_docstring_signature = True #default + directive.env.config.autoclass_content = 'class' + assert getdocl('class', E) == ['Class docstring'] + directive.env.config.autoclass_content = 'init' + assert getdocl('class', E) == ['Init docstring'] + directive.env.config.autoclass_content = 'both' + assert getdocl('class', E) == ['Class docstring', '', 'Init docstring'] + @with_setup(setup_test) def test_docstring_processing(): |