summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/roots/test-ext-autodoc/target/coroutine.py10
-rw-r--r--tests/test_autodoc.py18
-rw-r--r--tests/test_ext_intersphinx.py6
-rw-r--r--tests/test_util_inspect.py10
-rw-r--r--tests/test_util_inventory.py1
5 files changed, 44 insertions, 1 deletions
diff --git a/tests/roots/test-ext-autodoc/target/coroutine.py b/tests/roots/test-ext-autodoc/target/coroutine.py
index b3223a820..69602325d 100644
--- a/tests/roots/test-ext-autodoc/target/coroutine.py
+++ b/tests/roots/test-ext-autodoc/target/coroutine.py
@@ -3,6 +3,16 @@ class AsyncClass:
"""A documented coroutine function"""
attr_coro_result = await _other_coro_func() # NOQA
+ @classmethod
+ async def do_coroutine2(cls):
+ """A documented coroutine classmethod"""
+ pass
+
+ @staticmethod
+ async def do_coroutine3():
+ """A documented coroutine staticmethod"""
+ pass
+
async def _other_coro_func():
return "run"
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index e6b4cc5b6..d81df8245 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -1356,7 +1356,23 @@ def test_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',
+ ' ',
]
diff --git a/tests/test_ext_intersphinx.py b/tests/test_ext_intersphinx.py
index 9f0f18663..53faa7a37 100644
--- a/tests/test_ext_intersphinx.py
+++ b/tests/test_ext_intersphinx.py
@@ -190,6 +190,12 @@ def test_missing_reference_pydomain(tempdir, app, status, warning):
rn = missing_reference(app, app.env, node, contnode)
assert rn.astext() == 'func()'
+ # py:attr context helps to search objects
+ kwargs = {'py:module': 'module1'}
+ node, contnode = fake_node('py', 'attr', 'Foo.bar', 'Foo.bar', **kwargs)
+ rn = missing_reference(app, app.env, node, contnode)
+ assert rn.astext() == 'Foo.bar'
+
def test_missing_reference_stddomain(tempdir, app, status, warning):
inv_file = tempdir / 'inventory'
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py
index 5c9520370..627d20f54 100644
--- a/tests/test_util_inspect.py
+++ b/tests/test_util_inspect.py
@@ -435,6 +435,16 @@ def test_dict_customtype():
@pytest.mark.sphinx(testroot='ext-autodoc')
+def test_isclassmethod(app):
+ from target.methods import Base, Inherited
+
+ assert inspect.isclassmethod(Base.classmeth) is True
+ assert inspect.isclassmethod(Base.meth) is False
+ assert inspect.isclassmethod(Inherited.classmeth) is True
+ assert inspect.isclassmethod(Inherited.meth) is False
+
+
+@pytest.mark.sphinx(testroot='ext-autodoc')
def test_isstaticmethod(app):
from target.methods import Base, Inherited
diff --git a/tests/test_util_inventory.py b/tests/test_util_inventory.py
index 7491b217d..2183313e1 100644
--- a/tests/test_util_inventory.py
+++ b/tests/test_util_inventory.py
@@ -31,6 +31,7 @@ inventory_v2 = '''\
module1 py:module 0 foo.html#module-module1 Long Module desc
module2 py:module 0 foo.html#module-$ -
module1.func py:function 1 sub/foo.html#$ -
+module1.Foo.bar py:method 1 index.html#foo.Bar.baz -
CFunc c:function 2 cfunc.html#CFunc -
std cpp:type 1 index.html#std -
std::uint8_t cpp:type 1 index.html#std_uint8_t -