Georg Brandl committed 90b1960

Fix autoclass_content = "both" bug.

Comments (0)

Files changed (3)

 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


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


     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():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.