diff --git a/tests/domain/epc/test_roof_sloping_ceiling_guard.py b/tests/domain/epc/test_roof_sloping_ceiling_guard.py index 022b36460..d2820826f 100644 --- a/tests/domain/epc/test_roof_sloping_ceiling_guard.py +++ b/tests/domain/epc/test_roof_sloping_ceiling_guard.py @@ -40,3 +40,46 @@ def test_sloping_ceiling_without_a_depth_resolves_to_as_built( # Assert assert member is RoofType.PITCHED_SLOPING_CEILING_AS_BUILT + + +@pytest.mark.parametrize( + ("description", "expected"), + [ + # Exact tabulated depths → their own member. + ("PitchedWithSlopingCeiling: 12mm", RoofType.PITCHED_SLOPING_CEILING_12MM), + ("PitchedWithSlopingCeiling: 100mm", RoofType.PITCHED_SLOPING_CEILING_100MM), + ("PitchedWithSlopingCeiling: 150 mm", RoofType.PITCHED_SLOPING_CEILING_150MM), + ("PitchedWithSlopingCeiling: 270mm", RoofType.PITCHED_SLOPING_CEILING_270MM), + ("PitchedWithSlopingCeiling: 400mm", RoofType.PITCHED_SLOPING_CEILING_400MM), + # Off-ladder depth snaps to the nearest tabulated depth ≤ N (mirrors the + # calculator's `_ROOF_BY_THICKNESS` picker), so nothing leaks to the LLM. + ("PitchedWithSlopingCeiling: 130mm", RoofType.PITCHED_SLOPING_CEILING_125MM), + # Above 400 mm, or an explicit "400+" lodgement → the 400+ member. + ("PitchedWithSlopingCeiling: 450mm", RoofType.PITCHED_SLOPING_CEILING_400_PLUS), + ("PitchedWithSlopingCeiling: 400+mm", RoofType.PITCHED_SLOPING_CEILING_400_PLUS), + ], +) +def test_sloping_ceiling_measured_depth_resolves_to_its_ladder_member( + description: str, expected: RoofType +) -> None: + # ADR-0066: a measured sloping-ceiling depth rides onto the matching ladder + # member (Table 17 col (1a)); off-ladder depths snap down; ≥ 400 / "400+" + # caps at the top member. + + # Act + member = roof_sloping_ceiling_guard(description) + + # Assert + assert member is expected + + +def test_sloping_ceiling_depth_below_the_ladder_falls_back_to_as_built() -> None: + # No member exists below 12 mm; a sub-ladder depth defers to `as built` (the + # age band drives it — uninsulated at old bands anyway), never inventing a + # member or leaking to the loft LLM route. + + # Act + member = roof_sloping_ceiling_guard("PitchedWithSlopingCeiling: 5mm") + + # Assert + assert member is RoofType.PITCHED_SLOPING_CEILING_AS_BUILT