Skip to content

Commit c6f2c90

Browse files
committed
Rewrite MagicMixin class
1 parent 3e1b90b commit c6f2c90

File tree

1 file changed

+78
-2
lines changed

1 file changed

+78
-2
lines changed

stdlib/unittest/mock.pyi

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import MaybeNone
3-
from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence
3+
from collections.abc import AsyncIterator, Awaitable, Callable, Coroutine, Iterable, Iterator, Mapping, Sequence
44
from contextlib import _GeneratorContextManager
55
from types import TracebackType
66
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
@@ -472,7 +472,83 @@ class _patcher:
472472
patch: _patcher
473473

474474
class MagicMixin(Base):
475-
def __init__(self, *args: Any, **kw: Any) -> None: ...
475+
def __lt__(self, other: object) -> Any: ...
476+
def __gt__(self, other: object) -> Any: ...
477+
def __ge__(self, other: object) -> Any: ...
478+
def __le__(self, other: object) -> Any: ...
479+
def __int__(self) -> Literal[1]: ...
480+
def __containts__(self) -> Literal[False]: ...
481+
def __len__(self) -> Literal[0]: ...
482+
def __exit__(self, exctype: object, excinst: object, exctb: object, /) -> Literal[False]: ...
483+
def __aexit__(self, exctype: object, excinst: object, exctb: object, /) -> Literal[False]: ...
484+
def __next__(self) -> Self: ...
485+
def __anext__(self) -> AsyncMockMixin: ...
486+
def __complex__(self) -> complex: ...
487+
def __float__(self) -> float: ...
488+
def __bool__(self) -> Literal[True]: ...
489+
def __index__(self) -> Literal[1]: ...
490+
def __hash__(self) -> int: ...
491+
def __sizeof__(self) -> int: ...
492+
def __fspath__(self) -> str: ...
493+
def __eq__(self, other: object, /) -> Any: ...
494+
def __ne__(self, other: object, /) -> Any: ...
495+
def __iter__(self) -> Iterator[Any]: ...
496+
def __aiter__(self) -> AsyncIterator[Any]: ...
497+
def __abs__(self, *args: Any, **kwargs: Any) -> Self: ...
498+
def __add__(self, *args: Any, **kwargs: Any) -> Self: ...
499+
def __aenter__(self, *args: Any, **kwargs: Any) -> Self: ...
500+
def __and__(self, *args: Any, **kwargs: Any) -> Self: ...
501+
def __ceil__(self, *args: Any, **kwargs: Any) -> Self: ...
502+
def __delitem__(self, *args: Any, **kwargs: Any) -> Self: ...
503+
def __divmod__(self, *args: Any, **kwargs: Any) -> Self: ...
504+
def __enter__(self, *args: Any, **kwargs: Any) -> Self: ...
505+
def __floor__(self, *args: Any, **kwargs: Any) -> Self: ...
506+
def __floordiv__(self, *args: Any, **kwargs: Any) -> Self: ...
507+
def __getitem__(self, *args: Any, **kwargs: Any) -> Self: ...
508+
def __iadd__(self, *args: Any, **kwargs: Any) -> Self: ...
509+
def __iand__(self, *args: Any, **kwargs: Any) -> Self: ...
510+
def __ifloordiv__(self, *args: Any, **kwargs: Any) -> Self: ...
511+
def __ilshift__(self, *args: Any, **kwargs: Any) -> Self: ...
512+
def __imatmul__(self, *args: Any, **kwargs: Any) -> Self: ...
513+
def __imod__(self, *args: Any, **kwargs: Any) -> Self: ...
514+
def __imul__(self, *args: Any, **kwargs: Any) -> Self: ...
515+
def __invert__(self, *args: Any, **kwargs: Any) -> Self: ...
516+
def __ior__(self, *args: Any, **kwargs: Any) -> Self: ...
517+
def __ipow__(self, *args: Any, **kwargs: Any) -> Self: ...
518+
def __irshift__(self, *args: Any, **kwargs: Any) -> Self: ...
519+
def __isub__(self, *args: Any, **kwargs: Any) -> Self: ...
520+
def __itruediv__(self, *args: Any, **kwargs: Any) -> Self: ...
521+
def __ixor__(self, *args: Any, **kwargs: Any) -> Self: ...
522+
def __lshift__(self, *args: Any, **kwargs: Any) -> Self: ...
523+
def __matmul__(self, *args: Any, **kwargs: Any) -> Self: ...
524+
def __mod__(self, *args: Any, **kwargs: Any) -> Self: ...
525+
def __mul__(self, *args: Any, **kwargs: Any) -> Self: ...
526+
def __neg__(self, *args: Any, **kwargs: Any) -> Self: ...
527+
def __or__(self, *args: Any, **kwargs: Any) -> Self: ...
528+
def __pos__(self, *args: Any, **kwargs: Any) -> Self: ...
529+
def __pow__(self, *args: Any, **kwargs: Any) -> Self: ...
530+
def __radd__(self, *args: Any, **kwargs: Any) -> Self: ...
531+
def __rand__(self, *args: Any, **kwargs: Any) -> Self: ...
532+
def __rdivmod__(self, *args: Any, **kwargs: Any) -> Self: ...
533+
def __rfloordiv__(self, *args: Any, **kwargs: Any) -> Self: ...
534+
def __rlshift__(self, *args: Any, **kwargs: Any) -> Self: ...
535+
def __rmatmul__(self, *args: Any, **kwargs: Any) -> Self: ...
536+
def __rmod__(self, *args: Any, **kwargs: Any) -> Self: ...
537+
def __rmul__(self, *args: Any, **kwargs: Any) -> Self: ...
538+
def __ror__(self, *args: Any, **kwargs: Any) -> Self: ...
539+
def __round__(self, *args: Any, **kwargs: Any) -> Self: ...
540+
def __rpow__(self, *args: Any, **kwargs: Any) -> Self: ...
541+
def __rrshift__(self, *args: Any, **kwargs: Any) -> Self: ...
542+
def __rshift__(self, *args: Any, **kwargs: Any) -> Self: ...
543+
def __rsub__(self, *args: Any, **kwargs: Any) -> Self: ...
544+
def __rtruediv__(self, *args: Any, **kwargs: Any) -> Self: ...
545+
def __rxor__(self, *args: Any, **kwargs: Any) -> Self: ...
546+
def __setitem__(self, *args: Any, **kwargs: Any) -> Self: ...
547+
def __sub__(self, *args: Any, **kwargs: Any) -> Self: ...
548+
def __truediv__(self, *args: Any, **kwargs: Any) -> Self: ...
549+
def __trunc__(self, *args: Any, **kwargs: Any) -> Self: ...
550+
def __xor__(self, *args: Any, **kwargs: Any) -> Self: ...
551+
def __getattr__(self, attr: str, /) -> Any: ...
476552

477553
class NonCallableMagicMock(MagicMixin, NonCallableMock): ...
478554
class MagicMock(MagicMixin, Mock): ...

0 commit comments

Comments
 (0)