diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-01-23 23:47:04 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-01-25 00:57:36 +0900 |
commit | ecf38edb439cb8dc76d3a31adc5e358c8c859f97 (patch) | |
tree | 9f79e3c7e50fd3ce07a4d1f65c752203685418f1 /tests/test_autodoc.py | |
parent | f8fc6075ba317ba694ae4df5227a5358a08df6e3 (diff) | |
download | sphinx-git-ecf38edb439cb8dc76d3a31adc5e358c8c859f97.tar.gz |
Close #7051: autodoc: Support instance variables without defaults (PEP-526)
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r-- | tests/test_autodoc.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 6ee2c6ea9..05cc8bc74 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -1388,6 +1388,47 @@ 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: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, |