Skip to content

Commit

Permalink
tools.memories: define __eq__()/__ne__() of SopelIdentifierMemory
Browse files Browse the repository at this point in the history
At this time, two `SopelIdentifierMemory` objects are considered equal
if their keys and values compare as equal, even if they use different
`make_identifier` functions. This could change in the future, but seems
good enough for now.
  • Loading branch information
dgw committed Oct 24, 2023
1 parent ad38046 commit df0cf31
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sopel/tools/memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,11 @@ def __ior__(self, other):
return NotImplemented
self.update(other)
return self

def __eq__(self, other):
if not isinstance(other, dict):
return NotImplemented
return super().__eq__(other)

def __ne__(self, other):
return not self.__eq__(other)

0 comments on commit df0cf31

Please sign in to comment.