test(core): add unit tests for untested core modules
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 13s
Test before pr merge / test (pull_request) Successful in 40s

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>
This commit is contained in:
clu
2026-04-13 18:40:01 +02:00
parent bcca7090d3
commit ca58f636ee
13 changed files with 605 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
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