Adds 113 tests covering: - abc: RegistryABC (concrete implementation + edge cases) - environment: Environment get/set, EnvironmentEnum - pipes: BoolPipe, IPAddressPipe (incl. roundtrip + error cases) - time: Cron (next(), intervals, invalid expression) - utils: Cache (TTL, expiry, cleanup), get_value (incl. bug documentation: cast result not returned for string->typed values), JSONProcessor (nested objects, enums, defaults) - property: classproperty (class access, instance access, subclass) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
986 B
Python
37 lines
986 B
Python
import pytest
|
|
from cpl.core.pipes.bool_pipe import BoolPipe
|
|
|
|
|
|
def test_to_str_true():
|
|
assert BoolPipe.to_str(True) == "true"
|
|
|
|
|
|
def test_to_str_false():
|
|
assert BoolPipe.to_str(False) == "false"
|
|
|
|
|
|
def test_from_str_true_values():
|
|
assert BoolPipe.from_str("True") is True
|
|
assert BoolPipe.from_str("true") is True
|
|
assert BoolPipe.from_str("1") is True
|
|
assert BoolPipe.from_str("yes") is True
|
|
assert BoolPipe.from_str("y") is True
|
|
assert BoolPipe.from_str("Y") is True
|
|
|
|
|
|
def test_from_str_false_values():
|
|
assert BoolPipe.from_str("false") is False
|
|
assert BoolPipe.from_str("False") is False
|
|
assert BoolPipe.from_str("0") is False
|
|
assert BoolPipe.from_str("no") is False
|
|
assert BoolPipe.from_str("") is False
|
|
assert BoolPipe.from_str("anything") is False
|
|
|
|
|
|
def test_roundtrip_true():
|
|
assert BoolPipe.from_str(BoolPipe.to_str(True)) is True
|
|
|
|
|
|
def test_roundtrip_false():
|
|
assert BoolPipe.from_str(BoolPipe.to_str(False)) is False
|