diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-04-27 22:48:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-27 22:48:02 +0900 |
commit | 1cffff2a3024a8aeb4a7f9af9a10198d1d97c76c (patch) | |
tree | 293c037149d690b57fdefe2ac37c4569957a5610 /tests/test_autodoc.py | |
parent | 7a40ed0f271057b668076593db1d9a9d68baf8d3 (diff) | |
parent | 65c9df83033ef248c57e1405d99a35a3751f2ed8 (diff) | |
download | sphinx-git-1cffff2a3024a8aeb4a7f9af9a10198d1d97c76c.tar.gz |
Merge pull request #7487 from thomascobb/singledispatch_autofunction
Support singledispatch autodoc directives
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r-- | tests/test_autodoc.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 7cdb074d2..51ae3ddc3 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -1603,6 +1603,21 @@ def test_singledispatch(): ] +@pytest.mark.usefixtures('setup_test') +def test_singledispatch_autofunction(): + options = {} + actual = do_autodoc(app, 'function', 'target.singledispatch.func', options) + assert list(actual) == [ + '', + '.. py:function:: func(arg, kwarg=None)', + ' func(arg: int, kwarg=None)', + ' func(arg: str, kwarg=None)', + ' :module: target.singledispatch', + '', + ' A function for general use.', + '', + ] + @pytest.mark.skipif(sys.version_info < (3, 8), reason='singledispatchmethod is available since python3.8') @pytest.mark.usefixtures('setup_test') @@ -1630,6 +1645,23 @@ def test_singledispatchmethod(): ] +@pytest.mark.skipif(sys.version_info < (3, 8), + reason='singledispatchmethod is available since python3.8') +@pytest.mark.usefixtures('setup_test') +def test_singledispatchmethod_automethod(): + options = {} + actual = do_autodoc(app, 'method', 'target.singledispatchmethod.Foo.meth', options) + assert list(actual) == [ + '', + '.. py:method:: Foo.meth(arg, kwarg=None)', + ' Foo.meth(arg: int, kwarg=None)', + ' Foo.meth(arg: str, kwarg=None)', + ' :module: target.singledispatchmethod', + '', + ' A method for general use.', + '', + ] + @pytest.mark.usefixtures('setup_test') @pytest.mark.skipif(pyximport is None, reason='cython is not installed') def test_cython(): |