mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
import builtins
|
|
from typing import Union
|
|
|
|
s: builtins.type[int] | builtins.type[str] | builtins.type[complex]
|
|
t: type[int] | type[str] | type[float]
|
|
u: builtins.type[int] | type[str] | builtins.type[complex]
|
|
v: Union[type[float], type[complex]]
|
|
w: Union[type[Union[float, int]], type[complex]]
|
|
x: Union[Union[type[Union[float, int]], type[complex]]]
|
|
y: Union[Union[Union[type[Union[float, int]], type[complex]]]]
|
|
z: Union[type[complex], Union[Union[type[Union[float, int]]]]]
|
|
|
|
def func(arg: type[int] | str | type[float]) -> None: ...
|
|
|
|
# OK
|
|
x: type[int | str | float]
|
|
y: builtins.type[int | str | complex]
|
|
z: Union[float, complex]
|
|
|
|
def func(arg: type[int, float] | str) -> None: ...
|
|
|
|
# PYI055
|
|
item: type[requests_mock.Mocker] | type[httpretty] = requests_mock.Mocker
|
|
|
|
def func():
|
|
# PYI055
|
|
item: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
|
|
item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
|
|
item3: Union[ # comment
|
|
type[requests_mock.Mocker], # another comment
|
|
type[httpretty], type[str]] = requests_mock.Mocker
|
|
|
|
|
|
# OK
|
|
w: Union[type[float, int], type[complex]]
|
|
x: Union[Union[type[float, int], type[complex]]]
|
|
y: Union[Union[Union[type[float, int], type[complex]]]]
|
|
z: Union[type[complex], Union[Union[type[float, int]]]]
|