diff options
Diffstat (limited to 'tests/test_ext_autodoc.py')
-rw-r--r-- | tests/test_ext_autodoc.py | 91 |
1 files changed, 23 insertions, 68 deletions
diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py index 4c16886b3..c853fbb03 100644 --- a/tests/test_ext_autodoc.py +++ b/tests/test_ext_autodoc.py @@ -984,7 +984,7 @@ def test_autodoc_inner_class(app): ' .. py:attribute:: Outer.factory', ' :module: target', '', - ' alias of :class:`dict`' + ' alias of :py:class:`dict`' ] actual = do_autodoc(app, 'class', 'target.Outer.Inner', options) @@ -1009,7 +1009,7 @@ def test_autodoc_inner_class(app): '', '.. py:class:: InnerChild()', ' :module: target', '', - ' Bases: :class:`target.Outer.Inner`', + ' Bases: :py:class:`target.Outer.Inner`', '', ' InnerChild docstring', '', @@ -1084,6 +1084,7 @@ def test_autodoc_cached_property(app): '', ' .. py:property:: Foo.prop', ' :module: target.cached_property', + ' :type: int', '', ] @@ -1358,6 +1359,7 @@ def test_slots(app): '', ' .. py:attribute:: Bar.attr1', ' :module: target.slots', + ' :type: int', '', ' docstring of attr1', '', @@ -1399,15 +1401,15 @@ def test_enum_class(app): options = {"members": None} actual = do_autodoc(app, 'class', 'target.enums.EnumCls', options) - if sys.version_info < (3, 10): - sig = '(value)' + if sys.version_info > (3, 11): + args = ('(value, names=None, *, module=None, qualname=None, ' + 'type=None, start=1, boundary=None)') else: - sig = ('(value, names=None, *, module=None, qualname=None, type=None, start=1, ' - 'boundary=None)') + args = '(value)' assert list(actual) == [ '', - '.. py:class:: EnumCls%s' % sig, + '.. py:class:: EnumCls' + args, ' :module: target.enums', '', ' this is enum class', @@ -1626,59 +1628,6 @@ def test_bound_method(app): @pytest.mark.sphinx('html', testroot='ext-autodoc') -def test_coroutine(app): - actual = do_autodoc(app, 'function', 'target.functions.coroutinefunc') - assert list(actual) == [ - '', - '.. py:function:: coroutinefunc()', - ' :module: target.functions', - ' :async:', - '', - ] - - options = {"members": None} - actual = do_autodoc(app, 'class', 'target.coroutine.AsyncClass', options) - assert list(actual) == [ - '', - '.. py:class:: AsyncClass()', - ' :module: target.coroutine', - '', - '', - ' .. py:method:: AsyncClass.do_coroutine()', - ' :module: target.coroutine', - ' :async:', - '', - ' A documented coroutine function', - '', - '', - ' .. py:method:: AsyncClass.do_coroutine2()', - ' :module: target.coroutine', - ' :async:', - ' :classmethod:', - '', - ' A documented coroutine classmethod', - '', - '', - ' .. py:method:: AsyncClass.do_coroutine3()', - ' :module: target.coroutine', - ' :async:', - ' :staticmethod:', - '', - ' A documented coroutine staticmethod', - '', - ] - - # force-synchronized wrapper - actual = do_autodoc(app, 'function', 'target.coroutine.sync_func') - assert list(actual) == [ - '', - '.. py:function:: sync_func()', - ' :module: target.coroutine', - '', - ] - - -@pytest.mark.sphinx('html', testroot='ext-autodoc') def test_partialmethod(app): expected = [ '', @@ -1756,7 +1705,7 @@ def test_autodoc_typed_instance_variables(app): '.. py:attribute:: Alias', ' :module: target.typed_vars', '', - ' alias of :class:`target.typed_vars.Derived`', + ' alias of :py:class:`target.typed_vars.Derived`', '', '.. py:class:: Class()', ' :module: target.typed_vars', @@ -1921,12 +1870,15 @@ def test_autodoc_GenericAlias(app): ' .. py:attribute:: Class.T', ' :module: target.genericalias', '', - ' alias of :class:`~typing.List`\\ [:class:`int`]', + ' A list of int', + '', + ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]', '', '.. py:attribute:: T', ' :module: target.genericalias', '', - ' alias of :class:`~typing.List`\\ [:class:`int`]', + ' A list of int', + '', ] else: assert list(actual) == [ @@ -1943,7 +1895,7 @@ def test_autodoc_GenericAlias(app): '', ' A list of int', '', - ' alias of :class:`~typing.List`\\ [:class:`int`]', + ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]', '', '', '.. py:data:: T', @@ -1951,7 +1903,7 @@ def test_autodoc_GenericAlias(app): '', ' A list of int', '', - ' alias of :class:`~typing.List`\\ [:class:`int`]', + ' alias of :py:class:`~typing.List`\\ [:py:class:`int`]', '', ] @@ -1983,7 +1935,7 @@ def test_autodoc_TypeVar(app): '', ' T6', '', - ' alias of :class:`int`', + ' alias of :py:class:`int`', '', '', '.. py:data:: T1', @@ -2023,7 +1975,7 @@ def test_autodoc_TypeVar(app): '', ' T6', '', - ' alias of :class:`int`', + ' alias of :py:class:`int`', '', '', '.. py:data:: T7', @@ -2031,7 +1983,7 @@ def test_autodoc_TypeVar(app): '', ' T7', '', - " alias of TypeVar('T7', bound=\\ :class:`int`)", + " alias of TypeVar('T7', bound=\\ :py:class:`int`)", '', ] @@ -2165,6 +2117,9 @@ def test_singledispatchmethod_automethod(app): ] +@pytest.mark.skipif(sys.version_info > (3, 11), + reason=('cython does not support python-3.11 yet. ' + 'see https://github.com/cython/cython/issues/4365')) @pytest.mark.skipif(pyximport is None, reason='cython is not installed') @pytest.mark.sphinx('html', testroot='ext-autodoc') def test_cython(app): |