Implement equality for SecretBox
This commit is contained in:
parent
04440e6270
commit
f44f054f56
1 changed files with 6 additions and 0 deletions
|
|
@ -7,6 +7,12 @@ class SecretBox[T]:
|
|||
def expose_secret(self) -> T:
|
||||
return self._item
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, SecretBox):
|
||||
return False
|
||||
|
||||
return self._item == other._item
|
||||
|
||||
def __str__(self):
|
||||
return '<SECRET>'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue