Coverage for src / ocarina / aggregates / tests_layers.py: 62.50%
8 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-06-04 16:22 +0200
« prev ^ index » next coverage.py v7.13.5, created at 2026-06-04 16:22 +0200
1"""Helper functions for test results hierarchy."""
3from typing import TYPE_CHECKING, Any, TypeGuard
5from ocarina.railway.result import Fail, Ok
7if TYPE_CHECKING:
8 from ocarina.custom_types.oc_test_layers import TestResult
11def is_test_result_ok(result: TestResult) -> TypeGuard[Ok[Any]]:
12 """Check if test passed, narrowing type to Ok[Any]."""
13 return isinstance(result, Ok)
16def is_test_result_fail(result: TestResult) -> TypeGuard[Fail]:
17 """Check if test failed, narrowing type to Fail."""
18 return isinstance(result, Fail)
21def is_test_result_skipped(result: TestResult) -> TypeGuard[None]:
22 """Check if test was skipped, narrowing type to None."""
23 return result is None