summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-01-30 23:19:45 +0900
committerGitHub <noreply@github.com>2020-01-30 23:19:45 +0900
commit67fefcc6f965c99b26683782a86cbdce936cd19f (patch)
tree69c7e4609b4abd2702dda80dcd8567b21954bcb4 /tests/test_autodoc.py
parent5397664d4266464e092704f5a6e9b9ab92dfa915 (diff)
parent0cc625a82c029d59a443f17df9fa31eaf83bf336 (diff)
downloadsphinx-git-67fefcc6f965c99b26683782a86cbdce936cd19f.tar.gz
Merge branch '2.0' into 6418_autodoc_typehints_description
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py55
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,