summaryrefslogtreecommitdiff
path: root/tests/test_ext_autodoc_autofunction.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-05 02:21:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-05 02:21:47 +0900
commit8bf84167a30aa05886fcc1ed8895c8c20e939d89 (patch)
tree51252d17e9c5a344395d64fe4225759cb04f1f4c /tests/test_ext_autodoc_autofunction.py
parentb93aa3137af650ea01f3a68bb14e822bffe81309 (diff)
parentab707be1e1def8c904b5df0c5ddeaf2edacca0f6 (diff)
downloadsphinx-git-8bf84167a30aa05886fcc1ed8895c8c20e939d89.tar.gz
Merge branch '3.x'
Diffstat (limited to 'tests/test_ext_autodoc_autofunction.py')
-rw-r--r--tests/test_ext_autodoc_autofunction.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/tests/test_ext_autodoc_autofunction.py b/tests/test_ext_autodoc_autofunction.py
index bb292bc6a..3c8165995 100644
--- a/tests/test_ext_autodoc_autofunction.py
+++ b/tests/test_ext_autodoc_autofunction.py
@@ -9,6 +9,8 @@
:license: BSD, see LICENSE for details.
"""
+import sys
+
import pytest
from test_ext_autodoc import do_autodoc
@@ -40,6 +42,14 @@ def test_classes(app):
'',
]
+ actual = do_autodoc(app, 'function', 'target.classes.Qux')
+ assert list(actual) == [
+ '',
+ '.. py:function:: Qux(foo, bar)',
+ ' :module: target.classes',
+ '',
+ ]
+
@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_callable(app):
@@ -108,16 +118,23 @@ def test_decorated(app):
def test_singledispatch(app):
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.',
- '',
- ]
+ if sys.version_info < (3, 6):
+ # check the result via "in" because the order of singledispatch signatures is
+ # usually changed (because dict is not OrderedDict yet!)
+ assert '.. py:function:: func(arg, kwarg=None)' in actual
+ assert ' func(arg: int, kwarg=None)' in actual
+ assert ' func(arg: str, kwarg=None)' in actual
+ else:
+ 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.sphinx('html', testroot='ext-autodoc')