Skip to content

Commit a4c1ca1

Browse files
add test that description of class docstring is not used for attributes
1 parent 58cf671 commit a4c1ca1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

numpydoc/tests/test_docscrape.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,18 @@ def no_period(self):
12791279
""")
12801280

12811281

1282-
def test_class_members_as_member_list():
1282+
def test_class_attributes_as_member_list():
12831283

12841284
class Foo:
1285+
"""
1286+
Class docstring.
1287+
1288+
Attributes
1289+
----------
1290+
an_attribute
1291+
Another description that is not used.
1292+
1293+
"""
12851294
@property
12861295
def an_attribute(self):
12871296
"""Test attribute"""
@@ -1293,6 +1302,7 @@ def an_attribute(self):
12931302
Test attribute"""
12941303

12951304
assert attr_doc in str(SphinxClassDoc(Foo))
1305+
assert "Another description" not in str(SphinxClassDoc(Foo))
12961306

12971307
attr_doc2 = """.. rubric:: Attributes
12981308
@@ -1303,6 +1313,7 @@ def an_attribute(self):
13031313

13041314
cfg = dict(attributes_as_param_list=False)
13051315
assert attr_doc2 in str(SphinxClassDoc(Foo, config=cfg))
1316+
assert "Another description" not in str(SphinxClassDoc(Foo, config=cfg))
13061317

13071318

13081319
def test_templated_sections():

0 commit comments

Comments
 (0)