summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-28 01:42:37 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-28 01:42:37 +0900
commitaa773cbc88e692df731c78353a1043201bcb9f91 (patch)
tree2e5fc2c4659d73333a01f2a2c1c00420d98a801f /tests/test_autodoc.py
parentbee44bedb100d325e4e9dad681521819bd774f5f (diff)
parentba47b7055b03050ed7d7803cb0d1c7a335646ecf (diff)
downloadsphinx-git-aa773cbc88e692df731c78353a1043201bcb9f91.tar.gz
Merge branch '3.x'
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 3907e3465..51ae3ddc3 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -1511,6 +1511,13 @@ def test_autodoc_typed_instance_variables(app):
' attr6',
'',
'',
+ ' .. py:attribute:: Class.descr4',
+ ' :module: target.typed_vars',
+ ' :type: int',
+ '',
+ ' This is descr4',
+ '',
+ '',
'.. py:data:: attr1',
' :module: target.typed_vars',
' :type: str',
@@ -1596,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')
@@ -1623,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():