Skip to content

Commit b311805

Browse files
add test
1 parent 5c2f4fe commit b311805

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

numpydoc/tests/test_docscrape.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,32 @@ def no_period(self):
11791179
""")
11801180

11811181

1182+
def test_class_members_as_member_list():
1183+
1184+
class Foo:
1185+
@property
1186+
def an_attribute(self):
1187+
"""Test attribute"""
1188+
return None
1189+
1190+
attr_doc = """:Attributes:
1191+
1192+
:obj:`an_attribute <an_attribute>`
1193+
Test attribute"""
1194+
1195+
assert attr_doc in str(SphinxClassDoc(Foo))
1196+
1197+
attr_doc2 = """.. rubric:: Attributes
1198+
1199+
.. autosummary::
1200+
:toctree:
1201+
1202+
an_attribute"""
1203+
1204+
cfg = dict(attributes_as_param_list=False)
1205+
assert attr_doc2 in str(SphinxClassDoc(Foo, config=cfg))
1206+
1207+
11821208
def test_templated_sections():
11831209
doc = SphinxClassDoc(None, class_doc_txt,
11841210
config={'template': jinja2.Template('{{examples}}\n{{parameters}}')})

0 commit comments

Comments
 (0)