Core: String comparison with FreeText class (#2942)

This commit is contained in:
Alchav
2024-03-12 14:40:16 -05:00
committed by GitHub
parent 4bf676e588
commit 2692604c09

View File

@@ -180,6 +180,14 @@ class FreeText(Option[str]):
def get_option_name(cls, value: str) -> str:
return value
def __eq__(self, other):
if isinstance(other, self.__class__):
return other.value == self.value
elif isinstance(other, str):
return other == self.value
else:
raise TypeError(f"Can't compare {self.__class__.__name__} with {other.__class__.__name__}")
class NumericOption(Option[int], numbers.Integral, abc.ABC):
default = 0