mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Options: more feedback on bad compares (#362)
This commit is contained in:
@@ -180,10 +180,10 @@ class Choice(Option[int]):
|
|||||||
if isinstance(other, self.__class__):
|
if isinstance(other, self.__class__):
|
||||||
return other.value == self.value
|
return other.value == self.value
|
||||||
elif isinstance(other, str):
|
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
|
return other == self.current_key
|
||||||
elif isinstance(other, int):
|
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
|
return other == self.value
|
||||||
elif isinstance(other, bool):
|
elif isinstance(other, bool):
|
||||||
return other == bool(self.value)
|
return other == bool(self.value)
|
||||||
@@ -194,10 +194,10 @@ class Choice(Option[int]):
|
|||||||
if isinstance(other, self.__class__):
|
if isinstance(other, self.__class__):
|
||||||
return other.value != self.value
|
return other.value != self.value
|
||||||
elif isinstance(other, str):
|
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
|
return other != self.current_key
|
||||||
elif isinstance(other, int):
|
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
|
return other != self.value
|
||||||
elif isinstance(other, bool):
|
elif isinstance(other, bool):
|
||||||
return other != bool(self.value)
|
return other != bool(self.value)
|
||||||
|
|||||||
Reference in New Issue
Block a user