Skip to content

Commit 6ec2dd4

Browse files
committed
fix: fix equality implementation for Account, to allow comparison with arc4.Address
1 parent 93c6776 commit 6ec2dd4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/algopy_testing/models/account.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,13 @@ def __repr__(self) -> str:
131131
return self.public_key
132132

133133
def __eq__(self, other: object) -> bool:
134-
if not isinstance(other, Account | str):
135-
raise TypeError("Invalid value for Account")
136-
if isinstance(other, Account):
137-
return self._public_key == other._public_key
138-
return self._public_key == as_bytes(other)
134+
match other:
135+
case Account() as other_acc:
136+
return self._public_key == other_acc._public_key
137+
case str() as other_str:
138+
return self.public_key == other_str
139+
case _:
140+
return NotImplemented
139141

140142
def __bool__(self) -> bool:
141143
return bool(self._public_key) and self._public_key != algosdk.encoding.decode_address(

0 commit comments

Comments
 (0)