mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #10133: autodoc: Crashed when mocked module is used for type annotation
This commit is contained in:
@@ -213,6 +213,7 @@ def test_restify_broken_type_hints():
|
||||
def test_restify_mock():
|
||||
with mock(['unknown']):
|
||||
import unknown
|
||||
assert restify(unknown) == ':py:class:`unknown`'
|
||||
assert restify(unknown.secret.Class) == ':py:class:`unknown.secret.Class`'
|
||||
assert restify(unknown.secret.Class, "smart") == ':py:class:`~unknown.secret.Class`'
|
||||
|
||||
@@ -480,5 +481,6 @@ def test_stringify_broken_type_hints():
|
||||
def test_stringify_mock():
|
||||
with mock(['unknown']):
|
||||
import unknown
|
||||
assert stringify(unknown) == 'unknown'
|
||||
assert stringify(unknown.secret.Class) == 'unknown.secret.Class'
|
||||
assert stringify(unknown.secret.Class, "smart") == 'unknown.secret.Class'
|
||||
|
||||
Reference in New Issue
Block a user