From a717ff7a9930dea189d021e4ebe0c446f43ce671 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 23 Jul 2026 13:48:15 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20a=20measured=20sloping-ceiling=20dept?= =?UTF-8?q?h=20to=20its=20ladder=20member=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../epc/test_roof_sloping_ceiling_guard.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) 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