summaryrefslogtreecommitdiff
path: root/tests/test_ext_autodoc_mock.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-12-29 18:33:36 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-12-29 18:33:36 +0900
commit3f7bf48715ed5d6b0cf5d2645ee2886975b97b10 (patch)
tree737b5a11f1285b1bd342ae56ea07be516e2a57f4 /tests/test_ext_autodoc_mock.py
parentb24ae7e206ebcae194a048ac4d980fc7b32d333d (diff)
parentaaee3520f393babd87a34edda48793ed29804365 (diff)
downloadsphinx-git-3f7bf48715ed5d6b0cf5d2645ee2886975b97b10.tar.gz
Merge branch '3.4.x' into 3.x
Diffstat (limited to 'tests/test_ext_autodoc_mock.py')
-rw-r--r--tests/test_ext_autodoc_mock.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/test_ext_autodoc_mock.py b/tests/test_ext_autodoc_mock.py
index a29170f75..aa2da86c8 100644
--- a/tests/test_ext_autodoc_mock.py
+++ b/tests/test_ext_autodoc_mock.py
@@ -15,7 +15,7 @@ from typing import TypeVar
import pytest
-from sphinx.ext.autodoc.mock import _MockModule, _MockObject, mock
+from sphinx.ext.autodoc.mock import _MockModule, _MockObject, ismock, mock
def test_MockModule():
@@ -129,3 +129,19 @@ def test_mock_decorator():
assert func.__doc__ == "docstring"
assert Foo.meth.__doc__ == "docstring"
assert Bar.__doc__ == "docstring"
+
+
+def test_ismock():
+ with mock(['sphinx.unknown']):
+ mod1 = import_module('sphinx.unknown')
+ mod2 = import_module('sphinx.application')
+
+ class Inherited(mod1.Class):
+ pass
+
+ assert ismock(mod1) is True
+ assert ismock(mod1.Class) is True
+ assert ismock(Inherited) is False
+
+ assert ismock(mod2) is False
+ assert ismock(mod2.Sphinx) is False