Add testcase a partialmethod not having docstring (refs: #7023)

This commit is contained in:
Takeshi KOMIYA 2020-01-17 09:11:59 +09:00
parent ef811532c9
commit 7906a6871e
2 changed files with 36 additions and 7 deletions

View File

@ -14,5 +14,5 @@ class Cell(object):
#: Make a cell alive.
set_alive = partialmethod(set_state, True)
# a partialmethod with no docstring
set_dead = partialmethod(set_state, False)
"""Make a cell dead."""

View File

@ -1324,12 +1324,6 @@ def test_partialmethod(app):
' Make a cell alive.',
' ',
' ',
' .. py:method:: Cell.set_dead()',
' :module: target.partialmethod',
' ',
' Make a cell dead.',
' ',
' ',
' .. py:method:: Cell.set_state(state)',
' :module: target.partialmethod',
' ',
@ -1342,6 +1336,41 @@ def test_partialmethod(app):
assert list(actual) == expected
@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_partialmethod_undoc_members(app):
expected = [
'',
'.. py:class:: Cell',
' :module: target.partialmethod',
'',
' An example for partialmethod.',
' ',
' refs: https://docs.python.jp/3/library/functools.html#functools.partialmethod',
' ',
' ',
' .. py:method:: Cell.set_alive()',
' :module: target.partialmethod',
' ',
' Make a cell alive.',
' ',
' ',
' .. py:method:: Cell.set_dead()',
' :module: target.partialmethod',
' ',
' ',
' .. py:method:: Cell.set_state(state)',
' :module: target.partialmethod',
' ',
' Update state of cell to *state*.',
' ',
]
options = {"members": None,
"undoc-members": None}
actual = do_autodoc(app, 'class', 'target.partialmethod.Cell', options)
assert list(actual) == expected
@pytest.mark.sphinx('html', testroot='pycode-egg')
def test_autodoc_for_egged_code(app):
options = {"members": None,