|
72 | 72 |
|
73 | 73 | # Mypy does not support recursive type aliases, but
|
74 | 74 | # other type checkers do.
|
75 |
| -RecList = Union[int, List["RecList"]] # noqa: UP006 |
76 |
| -MutualRecA = Union[bool, List["MutualRecB"]] # noqa: UP006 |
77 |
| -MutualRecB = Union[str, List["MutualRecA"]] # noqa: UP006 |
| 75 | +RecList = Union[int, List["RecList"]] # noqa: UP006, UP007 |
| 76 | +MutualRecA = Union[bool, List["MutualRecB"]] # noqa: UP006, UP007 |
| 77 | +MutualRecB = Union[str, List["MutualRecA"]] # noqa: UP006, UP007 |
78 | 78 |
|
79 | 79 |
|
80 | 80 | class A:
|
@@ -150,7 +150,7 @@ def __getitem__(self, params): # noqa: ANN001, ANN204
|
150 | 150 | pytest.param(Dict[T, int], "typing", "Dict", (T, int), id="Dict_typevar"), # type: ignore[valid-type] # noqa: UP006
|
151 | 151 | pytest.param(Tuple, "typing", "Tuple", (), id="Tuple"), # noqa: UP006
|
152 | 152 | pytest.param(Tuple[str, int], "typing", "Tuple", (str, int), id="Tuple_parametrized"), # noqa: UP006
|
153 |
| - pytest.param(Union[str, int], "typing", "Union", (str, int), id="Union"), |
| 153 | + pytest.param(Union[str, int], "typing", "Union", (str, int), id="Union"), # noqa: UP007 |
154 | 154 | pytest.param(Callable, "typing", "Callable", (), id="Callable"),
|
155 | 155 | pytest.param(Callable[..., str], "typing", "Callable", (..., str), id="Callable_returntype"),
|
156 | 156 | pytest.param(Callable[[int, str], str], "typing", "Callable", (int, str, str), id="Callable_all_types"),
|
@@ -266,20 +266,32 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
|
266 | 266 | ),
|
267 | 267 | pytest.param(Union, ":py:data:`~typing.Union`", id="Union"),
|
268 | 268 | pytest.param(
|
269 |
| - Union[str, bool], r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`]", id="Union-str-bool" |
| 269 | + Union[str, bool], # noqa: UP007 |
| 270 | + r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`]", |
| 271 | + id="Union-str-bool", |
270 | 272 | ),
|
271 | 273 | pytest.param(
|
272 |
| - Union[str, bool, None], |
| 274 | + Union[str, bool, None], # noqa: UP007 |
273 | 275 | r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`, :py:obj:`None`]",
|
274 | 276 | id="Union-str-bool-None",
|
275 | 277 | ),
|
276 | 278 | pytest.param(
|
277 |
| - Union[str, Any], r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:data:`~typing.Any`]", id="Union-str-Any" |
| 279 | + Union[str, Any], # noqa: UP007 |
| 280 | + r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:data:`~typing.Any`]", |
| 281 | + id="Union-str-Any", |
278 | 282 | ),
|
279 |
| - pytest.param(Optional[str], r":py:data:`~typing.Optional`\ \[:py:class:`str`]", id="Optional-str"), |
280 |
| - pytest.param(Union[str, None], r":py:data:`~typing.Optional`\ \[:py:class:`str`]", id="Optional-str-None"), |
281 | 283 | pytest.param(
|
282 |
| - Optional[Union[str, bool]], |
| 284 | + Optional[str], # noqa: UP007 |
| 285 | + r":py:data:`~typing.Optional`\ \[:py:class:`str`]", |
| 286 | + id="Optional-str", |
| 287 | + ), |
| 288 | + pytest.param( |
| 289 | + Union[str, None], # noqa: UP007 |
| 290 | + r":py:data:`~typing.Optional`\ \[:py:class:`str`]", |
| 291 | + id="Optional-str-None", |
| 292 | + ), |
| 293 | + pytest.param( |
| 294 | + Optional[str | bool], # noqa: UP007 |
283 | 295 | r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`, :py:obj:`None`]",
|
284 | 296 | id="Optional-Union-str-bool",
|
285 | 297 | ),
|
|
0 commit comments