Skip to content

Commit 5149b9c

Browse files
committed
action dicts now get compared
1 parent 10ee288 commit 5149b9c

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

stormvogel/model.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -897,24 +897,20 @@ def __str__(self) -> str:
897897

898898
def __eq__(self, other) -> bool:
899899
if isinstance(other, Model):
900-
# TODO compare action dicts
901-
# if self.supports_actions():
902-
# actions_equal = sorted(self.actions.values()) == sorted(
903-
# other.actions.values()
904-
# )
905-
# else:
906-
# actions_equal = True
907-
908-
# if not actions_equal:
909-
# print(self.actions,'\n', other.actions)
900+
if self.supports_actions():
901+
assert self.actions is not None and other.actions is not None
902+
for action, other_action in zip(
903+
sorted(self.actions.values()), sorted(other.actions.values())
904+
):
905+
if not action == other_action:
906+
return False
910907
return (
911908
self.type == other.type
912909
and self.states == other.states
913910
and self.transitions == other.transitions
914911
and sorted(self.rewards) == sorted(other.rewards)
915912
and self.exit_rates == other.exit_rates
916913
and self.markovian_states == other.markovian_states
917-
# and actions_equal
918914
)
919915
return False
920916

0 commit comments

Comments
 (0)