diff options
author | Tom Cobb <tom.cobb@diamond.ac.uk> | 2020-04-24 15:15:22 +0100 |
---|---|---|
committer | Tom Cobb <tom.cobb@diamond.ac.uk> | 2020-04-24 15:25:50 +0100 |
commit | 22fafb9773e3e78b05072909c019d70545cf9226 (patch) | |
tree | 327995b0b694bb633706659594f7a716acf337cd /tests/test_autodoc.py | |
parent | 2fac698e764ac28dec86844624f4ac415ea11a37 (diff) | |
download | sphinx-git-22fafb9773e3e78b05072909c019d70545cf9226.tar.gz |
Support singledispatch in autofunction/methodThis makes autofunction and automethod work standalone withsingledispatch functions and methods. Previously only automodule wouldsupport these
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 dd474536d..8e23291f3 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -1604,6 +1604,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') @@ -1631,6 +1646,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(): |