diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-21 00:57:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 00:57:25 +0900 |
commit | 18b2707b2ac621f23f8ee6a7ca19bf1590be7826 (patch) | |
tree | 0a892c5222c151992adb3094c80450a2659f042d /tests/test_ext_autodoc_autodata.py | |
parent | 90dad94452bed1e2de3ccc43a3cef48ee67fc492 (diff) | |
parent | dcd8ff544aadbd75a6357457462be15e17fa2e67 (diff) | |
download | sphinx-git-18b2707b2ac621f23f8ee6a7ca19bf1590be7826.tar.gz |
Merge pull request #8444 from tk0miya/8443_autodata_for_pep526
Fix #8443: autodata directive does not support PEP-526 ivars
Diffstat (limited to 'tests/test_ext_autodoc_autodata.py')
-rw-r--r-- | tests/test_ext_autodoc_autodata.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_ext_autodoc_autodata.py b/tests/test_ext_autodoc_autodata.py index 7e4471db9..72665cdba 100644 --- a/tests/test_ext_autodoc_autodata.py +++ b/tests/test_ext_autodoc_autodata.py @@ -9,6 +9,8 @@ :license: BSD, see LICENSE for details. """ +import sys + import pytest from test_ext_autodoc import do_autodoc @@ -39,3 +41,34 @@ def test_autodata_novalue(app): ' documentation for the integer', '', ] + + +@pytest.mark.skipif(sys.version_info < (3, 6), reason='python 3.6+ is required.') +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_autodata_typed_variable(app): + actual = do_autodoc(app, 'data', 'target.typed_vars.attr2') + assert list(actual) == [ + '', + '.. py:data:: attr2', + ' :module: target.typed_vars', + ' :type: str', + '', + ' attr2', + '', + ] + + +@pytest.mark.skipif(sys.version_info < (3, 6), reason='python 3.6+ is required.') +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_autodata_type_comment(app): + actual = do_autodoc(app, 'data', 'target.typed_vars.attr3') + assert list(actual) == [ + '', + '.. py:data:: attr3', + ' :module: target.typed_vars', + ' :type: str', + " :value: ''", + '', + ' attr3', + '', + ] |