From 379d2c7cf627a1ff90833c1ca0ca7a4afb468390 Mon Sep 17 00:00:00 2001 From: Alex Ted Date: Sun, 27 Oct 2024 14:14:11 +0300 Subject: [PATCH] tests: fix import eqmock --- examples/minimal-async/tests/utils.py | 25 +++++++++++++++++++++++++ examples/minimal/tests/utils.py | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 examples/minimal-async/tests/utils.py create mode 100644 examples/minimal/tests/utils.py diff --git a/examples/minimal-async/tests/utils.py b/examples/minimal-async/tests/utils.py new file mode 100644 index 0000000..3ca33dc --- /dev/null +++ b/examples/minimal-async/tests/utils.py @@ -0,0 +1,25 @@ +from typing import Any + + +class EqMock: + value: Any = None + + def __init__(self, remember: bool = False) -> None: + self.remember: bool = remember + + def __eq__(self, other: Any) -> bool: # noqa: ANN401 + if self.remember and self.value is not None: + return self.value == other + else: + assert other, other + + if self.remember: + self.value = other + + return True + + def __repr__(self) -> str: + return repr(self.value) if self.remember else super().__repr__() + + def __str__(self) -> str: + return str(self.value) if self.remember else super().__str__() diff --git a/examples/minimal/tests/utils.py b/examples/minimal/tests/utils.py new file mode 100644 index 0000000..3ca33dc --- /dev/null +++ b/examples/minimal/tests/utils.py @@ -0,0 +1,25 @@ +from typing import Any + + +class EqMock: + value: Any = None + + def __init__(self, remember: bool = False) -> None: + self.remember: bool = remember + + def __eq__(self, other: Any) -> bool: # noqa: ANN401 + if self.remember and self.value is not None: + return self.value == other + else: + assert other, other + + if self.remember: + self.value = other + + return True + + def __repr__(self) -> str: + return repr(self.value) if self.remember else super().__repr__() + + def __str__(self) -> str: + return str(self.value) if self.remember else super().__str__()