diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-08-17 02:06:20 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-17 02:06:20 +0900 |
commit | 2604920232c9c7588f2a6f1ebfa15c506661cb10 (patch) | |
tree | a75740101d8592cee4b9629b31f377dbd2622c02 /tests/test_autodoc.py | |
parent | b926ee8aeb620dfaa3bd28566b3cf7f900c71def (diff) | |
parent | c4fa1aed340c32ff9b4b6cb2d5a6302951dea073 (diff) | |
download | sphinx-git-2604920232c9c7588f2a6f1ebfa15c506661cb10.tar.gz |
Merge pull request #5305 from tk0miya/5211_autodoc_for_partial_functions
Fix #5211: autodoc: No docs generated for functools.partial functions
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r-- | tests/test_autodoc.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 53d8a1e14..97e03c886 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -912,6 +912,44 @@ def test_generate(): 'module', 'autodoc_missing_imports') +@pytest.mark.usefixtures('setup_test') +def test_partialfunction(): + def call_autodoc(objtype, name): + inst = app.registry.documenters[objtype](directive, name) + inst.generate() + result = list(directive.result) + del directive.result[:] + return result + + options.members = ALL + #options.undoc_members = True + expected = [ + '', + '.. py:module:: target.partialfunction', + '', + '', + '.. py:function:: func1()', + ' :module: target.partialfunction', + '', + ' docstring of func1', + ' ', + '', + '.. py:function:: func2()', + ' :module: target.partialfunction', + '', + ' docstring of func1', + ' ', + '', + '.. py:function:: func3()', + ' :module: target.partialfunction', + '', + ' docstring of func3', + ' ' + ] + + assert call_autodoc('module', 'target.partialfunction') == expected + + @pytest.mark.skipif(sys.version_info < (3, 4), reason='functools.partialmethod is available on py34 or above') @pytest.mark.usefixtures('setup_test') |