Skip to content

Commit 70f01d6

Browse files
committed
Add a failing test
1 parent b428650 commit 70f01d6

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/metaclass_test.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,56 @@ class Child(Mixin, Parent):
240240
)
241241

242242

243+
def test_class_docstring_merge_hierarchy_numpy():
244+
@add_metaclass(DocInheritMeta(style="numpy_with_merge"))
245+
class GrandParent(object):
246+
"""GrandParent.
247+
248+
Attributes
249+
----------
250+
foo
251+
"""
252+
253+
class Parent(GrandParent):
254+
"""
255+
Attributes
256+
----------
257+
bar
258+
"""
259+
260+
class Child(Parent):
261+
pass
262+
263+
assert (
264+
getdoc(Child)
265+
== "GrandParent.\n\nAttributes\n----------\nfoo\nbar"
266+
)
267+
268+
269+
def test_class_docstring_merge_hierarchy_google():
270+
@add_metaclass(DocInheritMeta(style="google_with_merge"))
271+
class GrandParent(object):
272+
"""GrandParent.
273+
274+
Args:
275+
foo
276+
"""
277+
278+
class Parent(GrandParent):
279+
"""
280+
Args:
281+
bar
282+
"""
283+
284+
class Child(Parent):
285+
pass
286+
287+
assert (
288+
getdoc(Child)
289+
== "GrandParent.\n\nParameters:\n foo\n bar"
290+
)
291+
292+
243293
""" Include special method option"""
244294

245295
@add_metaclass(DocInheritMeta(style=style, include_special_methods=True))

0 commit comments

Comments
 (0)