Close #8034: autodoc: :private-member: can take an list of member names

Now :private-member: option can take an explicit list of member names to
be documented as its arguments (like :special-members: does).
This commit is contained in:
Takeshi KOMIYA
2020-08-02 01:26:05 +09:00
parent 5e6da19f0e
commit d7a84e83cc
5 changed files with 80 additions and 10 deletions

View File

@@ -60,3 +60,24 @@ def test_private_field_and_private_members(app):
' :meta private:',
'',
]
@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_private_members(app):
app.config.autoclass_content = 'class'
options = {"members": None,
"private-members": "_public_function"}
actual = do_autodoc(app, 'module', 'target.private', options)
assert list(actual) == [
'',
'.. py:module:: target.private',
'',
'',
'.. py:function:: _public_function(name)',
' :module: target.private',
'',
' public_function is a docstring().',
'',
' :meta public:',
'',
]