From 83376896400e7a0f06258f8a090dcf0dea773421 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 31 Mar 2022 03:29:45 +0200 Subject: [PATCH] Options: more feedback on bad compares (#362) --- Options.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Options.py b/Options.py index e20f5098..b75eb82f 100644 --- a/Options.py +++ b/Options.py @@ -180,10 +180,10 @@ class Choice(Option[int]): if isinstance(other, self.__class__): return other.value == self.value elif isinstance(other, str): - assert other in self.options, "compared against a str that could never be equal." + assert other in self.options, f"compared against a str that could never be equal. {self} == {other}" return other == self.current_key elif isinstance(other, int): - assert other in self.name_lookup, "compared against an int that could never be equal." + assert other in self.name_lookup, f"compared against an int that could never be equal. {self} == {other}" return other == self.value elif isinstance(other, bool): return other == bool(self.value) @@ -194,10 +194,10 @@ class Choice(Option[int]): if isinstance(other, self.__class__): return other.value != self.value elif isinstance(other, str): - assert other in self.options , "compared against a str that could never be equal." + assert other in self.options , f"compared against a str that could never be equal. {self} != {other}" return other != self.current_key elif isinstance(other, int): - assert other in self.name_lookup, "compared against am int that could never be equal." + assert other in self.name_lookup, f"compared against am int that could never be equal. {self} != {other}" return other != self.value elif isinstance(other, bool): return other != bool(self.value)