diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-05-30 21:17:20 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-06-06 12:45:20 +0900 |
| commit | 8bd5f8b214b25242487948931f8e9b9d1bcf9f98 (patch) | |
| tree | e6cc3ed9de74c0cd49ab0612a1acbab95a75dd07 /tests/test_ext_autodoc.py | |
| parent | cb5e094c0aee9cbfce56991c78dfe95a688ed5ab (diff) | |
| download | sphinx-git-8bd5f8b214b25242487948931f8e9b9d1bcf9f98.tar.gz | |
autodoc: Support TypeVar (refs: #7722)
Diffstat (limited to 'tests/test_ext_autodoc.py')
| -rw-r--r-- | tests/test_ext_autodoc.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py index e80e8b357..e4ec4a815 100644 --- a/tests/test_ext_autodoc.py +++ b/tests/test_ext_autodoc.py @@ -1618,6 +1618,46 @@ def test_autodoc_GenericAlias(app): ] +@pytest.mark.sphinx('html', testroot='ext-autodoc') +def test_autodoc_TypeVar(app): + options = {"members": None, + "undoc-members": None} + actual = do_autodoc(app, 'module', 'target.typevar', options) + assert list(actual) == [ + '', + '.. py:module:: target.typevar', + '', + '', + '.. py:data:: T1', + ' :module: target.typevar', + '', + ' T1', + '', + " alias of TypeVar('T1')", + '', + '.. py:data:: T3', + ' :module: target.typevar', + '', + ' T3', + '', + " alias of TypeVar('T3', int, str)", + '', + '.. py:data:: T4', + ' :module: target.typevar', + '', + ' T4', + '', + " alias of TypeVar('T4', covariant=True)", + '', + '.. py:data:: T5', + ' :module: target.typevar', + '', + ' T5', + '', + " alias of TypeVar('T5', contravariant=True)", + ] + + @pytest.mark.skipif(sys.version_info < (3, 9), reason='py39+ is required.') @pytest.mark.sphinx('html', testroot='ext-autodoc') def test_autodoc_Annotated(app): |
