diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-01-26 01:40:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-26 01:40:09 +0900 |
commit | 0cc625a82c029d59a443f17df9fa31eaf83bf336 (patch) | |
tree | ad220489fbef1edd8ae4680acb03fbbd4b262204 /tests/test_autodoc.py | |
parent | f8fc6075ba317ba694ae4df5227a5358a08df6e3 (diff) | |
parent | dcd8f41a77353468c6edbfac3e785aa94a5b632d (diff) | |
download | sphinx-git-0cc625a82c029d59a443f17df9fa31eaf83bf336.tar.gz |
Merge pull request #7057 from tk0miya/7051_ivar_without_defaults
Close #7051: autodoc: Support instance variables without defaults (PEP-526)
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r-- | tests/test_autodoc.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 6ee2c6ea9..b7c645be8 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -1388,6 +1388,61 @@ def test_partialmethod_undoc_members(app): assert list(actual) == expected +@pytest.mark.skipif(sys.version_info < (3, 6), reason='py36+ is available since python3.6.') +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_autodoc_typed_instance_variables(app): + options = {"members": None, + "undoc-members": True} + actual = do_autodoc(app, 'module', 'target.typed_vars', options) + assert list(actual) == [ + '', + '.. py:module:: target.typed_vars', + '', + '', + '.. py:class:: Class()', + ' :module: target.typed_vars', + '', + ' ', + ' .. py:attribute:: Class.attr1', + ' :module: target.typed_vars', + ' :annotation: = 0', + ' ', + ' ', + ' .. py:attribute:: Class.attr2', + ' :module: target.typed_vars', + ' :annotation: = None', + ' ', + ' ', + ' .. py:attribute:: Class.attr3', + ' :module: target.typed_vars', + ' :annotation: = None', + ' ', + ' attr3', + ' ', + ' ', + ' .. py:attribute:: Class.attr4', + ' :module: target.typed_vars', + ' :annotation: = None', + ' ', + ' attr4', + ' ', + '', + '.. py:data:: attr1', + ' :module: target.typed_vars', + " :annotation: = ''", + '', + ' attr1', + ' ', + '', + '.. py:data:: attr2', + ' :module: target.typed_vars', + " :annotation: = None", + '', + ' attr2', + ' ' + ] + + @pytest.mark.sphinx('html', testroot='pycode-egg') def test_autodoc_for_egged_code(app): options = {"members": None, |