diff --git a/src/celpy/celtypes.py b/src/celpy/celtypes.py index 3e47271..3b76a26 100644 --- a/src/celpy/celtypes.py +++ b/src/celpy/celtypes.py @@ -398,6 +398,12 @@ def __new__(cls: Type["BoolType"], source: Any) -> "BoolType": return source elif isinstance(source, MessageType): return super().__new__(cls, cast(int, source.get(StringType("value")))) + elif isinstance(source, (str, StringType)): + if source in ("False", "f", "FALSE", "false"): + return super().__new__(cls, 0) + elif source in ("True", "t", "TRUE", "true"): + return super().__new__(cls, 1) + return super().__new__(cls, source) else: return super().__new__(cls, source) diff --git a/tools/wip.toml b/tools/wip.toml index b2b0709..ec41079 100644 --- a/tools/wip.toml +++ b/tools/wip.toml @@ -225,16 +225,6 @@ not_ne_int_uint = "@wip" not_ne_uint_double = "@wip" not_ne_uint_double_nan = "@wip" -[conversions.bool] -string_f = "@wip" -string_false_lowercase = "@wip" -string_false_pascalcase = "@wip" -string_false_uppercase = "@wip" -string_t = "@wip" -string_true_lowercase = "@wip" -string_true_pascalcase = "@wip" -string_true_uppercase = "@wip" - [conversions.identity] timestamp = "@wip"