Skip to content

Commit 36a7d68

Browse files
committed
BUG: fix spacing in sphinx class doc attribute listing
1 parent 7c3a1dc commit 36a7d68

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

numpydoc/docscrape_sphinx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _str_member_list(self, name):
130130
maxlen_0 = max(3, max([len(x[0]) for x in others]))
131131
hdr = sixu("=")*maxlen_0 + sixu(" ") + sixu("=")*10
132132
fmt = sixu('%%%ds %%s ') % (maxlen_0,)
133-
out += ['', hdr]
133+
out += ['', '', hdr]
134134
for param, param_type, desc in others:
135135
desc = sixu(" ").join(x.strip() for x in desc).strip()
136136
if param_type:

numpydoc/tests/test_docscrape.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ def test_duplicate_signature():
677677
Current time.
678678
y : ndarray
679679
Current variable values.
680+
x : float
681+
Some parameter
680682
681683
Methods
682684
-------
@@ -712,6 +714,8 @@ def test_class_members_doc():
712714
Current time.
713715
y : ndarray
714716
Current variable values.
717+
x : float
718+
Some parameter
715719
716720
Methods
717721
-------
@@ -726,7 +730,13 @@ def test_class_members_doc():
726730
""")
727731

728732
def test_class_members_doc_sphinx():
729-
doc = SphinxClassDoc(None, class_doc_txt)
733+
class Foo:
734+
@property
735+
def x(self):
736+
"""Test attribute"""
737+
return None
738+
739+
doc = SphinxClassDoc(Foo, class_doc_txt)
730740
non_blank_line_by_line_compare(str(doc),
731741
"""
732742
Foo
@@ -747,6 +757,11 @@ def test_class_members_doc_sphinx():
747757
748758
.. rubric:: Attributes
749759
760+
.. autosummary::
761+
:toctree:
762+
763+
x
764+
750765
=== ==========
751766
t (float) Current time.
752767
y (ndarray) Current variable values.

0 commit comments

Comments
 (0)