5555 nptyping = None # type: ignore[assignment]
5656
5757T = TypeVar ("T" )
58- U = TypeVar ("U " , covariant = True )
59- V = TypeVar ("V " , contravariant = True )
58+ U_co = TypeVar ("U_co " , covariant = True )
59+ V_contra = TypeVar ("V_contra " , contravariant = True )
6060X = TypeVar ("X" , str , int )
6161Y = TypeVar ("Y" , bound = str )
6262Z = TypeVar ("Z" , bound = "A" )
@@ -211,13 +211,14 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
211211 ":py:class:`~typing.Mapping`\\ [:py:class:`~typing.TypeVar`\\ (``T``), :py:class:`int`]" ,
212212 ),
213213 (
214- Mapping [str , V ], # type: ignore[valid-type]
215- ":py:class:`~typing.Mapping`\\ [:py:class:`str`, :py:class:`~typing.TypeVar`\\ (``V``, contravariant=True)]" ,
214+ Mapping [str , V_contra ], # type: ignore[valid-type]
215+ ":py:class:`~typing.Mapping`\\ [:py:class:`str`, :py:class:`~typing.TypeVar`\\ ("
216+ "``V_contra``, contravariant=True)]" ,
216217 ),
217218 (
218- Mapping [T , U ], # type: ignore[valid-type]
219+ Mapping [T , U_co ], # type: ignore[valid-type]
219220 ":py:class:`~typing.Mapping`\\ [:py:class:`~typing.TypeVar`\\ (``T``), "
220- ":py:class:`~typing.TypeVar`\\ (``U ``, covariant=True)]" ,
221+ ":py:class:`~typing.TypeVar`\\ (``U_co ``, covariant=True)]" ,
221222 ),
222223 (Mapping [str , bool ], ":py:class:`~typing.Mapping`\\ [:py:class:`str`, :py:class:`bool`]" ),
223224 (Dict , ":py:class:`~typing.Dict`" ),
@@ -226,13 +227,13 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
226227 ":py:class:`~typing.Dict`\\ [:py:class:`~typing.TypeVar`\\ (``T``), :py:class:`int`]" ,
227228 ),
228229 (
229- Dict [str , V ], # type: ignore[valid-type]
230- ":py:class:`~typing.Dict`\\ [:py:class:`str`, :py:class:`~typing.TypeVar`\\ (``V ``, contravariant=True)]" ,
230+ Dict [str , V_contra ], # type: ignore[valid-type]
231+ ":py:class:`~typing.Dict`\\ [:py:class:`str`, :py:class:`~typing.TypeVar`\\ (``V_contra ``, contravariant=True)]" ,
231232 ),
232233 (
233- Dict [T , U ], # type: ignore[valid-type]
234+ Dict [T , U_co ], # type: ignore[valid-type]
234235 ":py:class:`~typing.Dict`\\ [:py:class:`~typing.TypeVar`\\ (``T``),"
235- " :py:class:`~typing.TypeVar`\\ (``U ``, covariant=True)]" ,
236+ " :py:class:`~typing.TypeVar`\\ (``U_co ``, covariant=True)]" ,
236237 ),
237238 (Dict [str , bool ], ":py:class:`~typing.Dict`\\ [:py:class:`str`, :py:class:`bool`]" ),
238239 (Tuple , ":py:data:`~typing.Tuple`" ),
@@ -283,8 +284,8 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
283284 (E [int ], ":py:class:`~%s.E`\\ [:py:class:`int`]" % __name__ ),
284285 (W , f":py:{ 'class' if PY310_PLUS else 'func' } :`~typing.NewType`\\ (``W``, :py:class:`str`)" ),
285286 (T , ":py:class:`~typing.TypeVar`\\ (``T``)" ),
286- (U , ":py:class:`~typing.TypeVar`\\ (``U ``, covariant=True)" ),
287- (V , ":py:class:`~typing.TypeVar`\\ (``V ``, contravariant=True)" ),
287+ (U_co , ":py:class:`~typing.TypeVar`\\ (``U_co ``, covariant=True)" ),
288+ (V_contra , ":py:class:`~typing.TypeVar`\\ (``V_contra ``, contravariant=True)" ),
288289 (X , ":py:class:`~typing.TypeVar`\\ (``X``, :py:class:`str`, :py:class:`int`)" ),
289290 (Y , ":py:class:`~typing.TypeVar`\\ (``Y``, bound= :py:class:`str`)" ),
290291 (Z , ":py:class:`~typing.TypeVar`\\ (``Z``, bound= A)" ),
0 commit comments