Skip to content

Commit

Permalink
tests: fix import eqmock
Browse files Browse the repository at this point in the history
  • Loading branch information
alexted committed Oct 27, 2024
1 parent 75d26e0 commit 379d2c7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/minimal-async/tests/utils.py
Original file line number Diff line number Diff line change
@@ -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__()
25 changes: 25 additions & 0 deletions examples/minimal/tests/utils.py
Original file line number Diff line number Diff line change
@@ -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__()

0 comments on commit 379d2c7

Please sign in to comment.