55
55
nptyping = None # type: ignore[assignment]
56
56
57
57
T = 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 )
60
60
X = TypeVar ("X" , str , int )
61
61
Y = TypeVar ("Y" , bound = str )
62
62
Z = TypeVar ("Z" , bound = "A" )
@@ -211,13 +211,14 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
211
211
":py:class:`~typing.Mapping`\\ [:py:class:`~typing.TypeVar`\\ (``T``), :py:class:`int`]" ,
212
212
),
213
213
(
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)]" ,
216
217
),
217
218
(
218
- Mapping [T , U ], # type: ignore[valid-type]
219
+ Mapping [T , U_co ], # type: ignore[valid-type]
219
220
":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)]" ,
221
222
),
222
223
(Mapping [str , bool ], ":py:class:`~typing.Mapping`\\ [:py:class:`str`, :py:class:`bool`]" ),
223
224
(Dict , ":py:class:`~typing.Dict`" ),
@@ -226,13 +227,13 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
226
227
":py:class:`~typing.Dict`\\ [:py:class:`~typing.TypeVar`\\ (``T``), :py:class:`int`]" ,
227
228
),
228
229
(
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)]" ,
231
232
),
232
233
(
233
- Dict [T , U ], # type: ignore[valid-type]
234
+ Dict [T , U_co ], # type: ignore[valid-type]
234
235
":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)]" ,
236
237
),
237
238
(Dict [str , bool ], ":py:class:`~typing.Dict`\\ [:py:class:`str`, :py:class:`bool`]" ),
238
239
(Tuple , ":py:data:`~typing.Tuple`" ),
@@ -283,8 +284,8 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
283
284
(E [int ], ":py:class:`~%s.E`\\ [:py:class:`int`]" % __name__ ),
284
285
(W , f":py:{ 'class' if PY310_PLUS else 'func' } :`~typing.NewType`\\ (``W``, :py:class:`str`)" ),
285
286
(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)" ),
288
289
(X , ":py:class:`~typing.TypeVar`\\ (``X``, :py:class:`str`, :py:class:`int`)" ),
289
290
(Y , ":py:class:`~typing.TypeVar`\\ (``Y``, bound= :py:class:`str`)" ),
290
291
(Z , ":py:class:`~typing.TypeVar`\\ (``Z``, bound= A)" ),
0 commit comments