From 7c18036af0cf32fd1cd7bc35f51a6d919909faa2 Mon Sep 17 00:00:00 2001 From: darksidecat <58224121+darksidecat@users.noreply.github.com> Date: Sun, 26 Jun 2022 13:52:02 +0300 Subject: [PATCH] update __eq__ method Co-authored-by: Oleg A. --- aiogram/dispatcher/fsm/state.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aiogram/dispatcher/fsm/state.py b/aiogram/dispatcher/fsm/state.py index 18f7520e..e6a204f8 100644 --- a/aiogram/dispatcher/fsm/state.py +++ b/aiogram/dispatcher/fsm/state.py @@ -55,7 +55,11 @@ class State: return raw_state == self.state def __eq__(self, other): - return self.state == other.state + if isinstance(other, self.__class__): + return self.state == other.state + if isinstance(other, str): + return self.state == other + raise ValueError(f"Comparing {type(self)} and {type(other)} is not supported") def __hash__(self): return hash(self.state)