Skip to content

Commit

Permalink
Array.__eq__ should call pt.equality.is_structurally_equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikcfd committed Oct 18, 2021
1 parent cc5d595 commit 2b47d9a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pytato/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,9 @@ def __hash__(self) -> int:
def __eq__(self, other: Any) -> bool:
if self is other:
return True
return (
isinstance(other, type(self))
and all(
getattr(self, field) == getattr(other, field)
for field in self._fields))

from pytato.equality import is_structurally_equivalent
return is_structurally_equivalent(self, other)

def __ne__(self, other: Any) -> bool:
return not self.__eq__(other)
Expand Down Expand Up @@ -788,8 +786,8 @@ def __eq__(self, other: Any) -> bool:
if self is other:
return True

return (isinstance(other, DictOfNamedArrays)
and self._data == other._data)
from pytato.equality import is_structurally_equivalent
return is_structurally_equivalent(self, other)

# }}}

Expand Down

0 comments on commit 2b47d9a

Please sign in to comment.