summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py41
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,