mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
autodoc: an imported TypeVar is not resolved (refs: #8415)
So far, a TypeVar is rendered without module name. As a result, it could not be resolved if it is imported from other modules. This prepends its module name and make it resolvable. This is available only in Python 3.7 or above. As a side effect, all of TypeVars are displayed with module name. It should be fixed in latter step (refs: #7119)
This commit is contained in:
@@ -142,7 +142,13 @@ def test_signature_annotations():
|
||||
|
||||
# TypeVars and generic types with TypeVars
|
||||
sig = inspect.signature(f2)
|
||||
assert stringify_signature(sig) == '(x: List[T], y: List[T_co], z: T) -> List[T_contra]'
|
||||
if sys.version_info < (3, 7):
|
||||
assert stringify_signature(sig) == '(x: List[T], y: List[T_co], z: T) -> List[T_contra]'
|
||||
else:
|
||||
assert stringify_signature(sig) == ('(x: List[tests.typing_test_data.T],'
|
||||
' y: List[tests.typing_test_data.T_co],'
|
||||
' z: tests.typing_test_data.T'
|
||||
') -> List[tests.typing_test_data.T_contra]')
|
||||
|
||||
# Union types
|
||||
sig = inspect.signature(f3)
|
||||
|
||||
Reference in New Issue
Block a user