Skip to content

Commit 6e4dc6f

Browse files
committed
like this? :)
1 parent 6caad73 commit 6e4dc6f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

stdlib/unittest/util.pyi

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
from _operator import _SupportsComparison
21
from collections.abc import MutableSequence, Sequence
3-
from typing import Final, Literal, TypeVar
2+
from typing import Any, Final, Literal, Protocol, TypeVar, type_check_only
43
from typing_extensions import TypeAlias
54

5+
@type_check_only
6+
class _SupportsDunderLT(Protocol):
7+
def __lt__(self, other: Any, /) -> bool: ...
8+
9+
@type_check_only
10+
class _SupportsDunderGT(Protocol):
11+
def __gt__(self, other: Any, /) -> bool: ...
12+
13+
@type_check_only
14+
class _SupportsDunderLE(Protocol):
15+
def __le__(self, other: Any, /) -> bool: ...
16+
17+
@type_check_only
18+
class _SupportsDunderGE(Protocol):
19+
def __ge__(self, other: Any, /) -> bool: ...
20+
621
_T = TypeVar("_T")
722
_Mismatch: TypeAlias = tuple[_T, _T, int]
23+
_SupportsComparison: TypeAlias = _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT
824

925
_MAX_LENGTH: Final = 80
1026
_PLACEHOLDER_LEN: Final = 12

0 commit comments

Comments
 (0)