Merge pull request #7030 from tk0miya/7023_testcase_for_partialmethod_not_having_docstring

Add testcase a partialmethod not having docstring (refs: #7023)
This commit is contained in:
Takeshi KOMIYA 2020-01-19 15:46:16 +09:00 committed by GitHub
commit 2adc12edb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 7 deletions

View File

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

View File

@ -1324,10 +1324,38 @@ def test_partialmethod(app):
' Make a cell alive.', ' Make a cell alive.',
' ', ' ',
' ', ' ',
' .. py:method:: Cell.set_dead()', ' .. py:method:: Cell.set_state(state)',
' :module: target.partialmethod', ' :module: target.partialmethod',
' ', ' ',
' Make a cell dead.', ' Update state of cell to *state*.',
' ',
]
options = {"members": None}
actual = do_autodoc(app, 'class', 'target.partialmethod.Cell', options)
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)', ' .. py:method:: Cell.set_state(state)',
@ -1337,7 +1365,8 @@ def test_partialmethod(app):
' ', ' ',
] ]
options = {"members": None} options = {"members": None,
"undoc-members": None}
actual = do_autodoc(app, 'class', 'target.partialmethod.Cell', options) actual = do_autodoc(app, 'class', 'target.partialmethod.Cell', options)
assert list(actual) == expected assert list(actual) == expected