summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2014-01-02 12:42:12 +0900
committershimizukawa <shimizukawa@gmail.com>2014-01-02 12:42:12 +0900
commit8e9cae6fd63804f85a84b0af29136131c4ff10b3 (patch)
tree7ad52ad50ea8234dc7ba33de28908a1ab0936e8e /tests
parent38e84a4ad91595d79e2eb024165b83ee1d9ce02f (diff)
downloadsphinx-8e9cae6fd63804f85a84b0af29136131c4ff10b3.tar.gz
Fix autodoc with ``autoclass_content="both"`` uses useless ``object.__init__`` docstring when class does not have ``__init__``. Closes #1337
This caused by a change for #1138.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_autodoc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 63c341f1..3735a7b6 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -334,6 +334,20 @@ def test_get_doc():
directive.env.config.autoclass_content = 'both'
assert getdocl('class', E) == ['Class docstring', '', 'Init docstring']
+ # class does not have __init__ method
+ class F(object):
+ """Class docstring"""
+
+ # docstring in the __init__ method of base class will be discard
+ for f in (False, True):
+ directive.env.config.autodoc_docstring_signature = f
+ directive.env.config.autoclass_content = 'class'
+ assert getdocl('class', F) == ['Class docstring']
+ directive.env.config.autoclass_content = 'init'
+ assert getdocl('class', F) == ['Class docstring']
+ directive.env.config.autoclass_content = 'both'
+ assert getdocl('class', F) == ['Class docstring']
+
@with_setup(setup_test)
def test_docstring_processing():