From 2fe5b79dc414967c92c63beea83c28a465c778d3 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 10 Jul 2026 16:03:39 +0000 Subject: [PATCH] =?UTF-8?q?Recommend=20loft=20insulation=20for=20a=20loft?= =?UTF-8?q?=20below=20the=20building-regs=20depth=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../modelling/test_roof_recommendation.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/domain/modelling/test_roof_recommendation.py b/tests/domain/modelling/test_roof_recommendation.py index 6759341ed..55b459da7 100644 --- a/tests/domain/modelling/test_roof_recommendation.py +++ b/tests/domain/modelling/test_roof_recommendation.py @@ -216,6 +216,32 @@ def test_unlodged_roof_type_with_nd_thickness_yields_no_recommendation() -> None assert recommendation is None +def test_loft_below_building_regs_depth_yields_loft_insulation() -> None: + # Arrange — property 724702's shape (ADR-0063): an unlodged roof type with a + # lodged 50 mm loft, below the 270 mm building-regs compliance gate. A + # measured depth is a positive statement of a real loft (unlike a sentinel on + # an unlodged type, which keeps deferring), so the below-regs top-up fires and + # reaches the 300 mm install depth. + baseline: EpcPropertyData = build_epc() + main: SapBuildingPart = _part(baseline, BuildingPartIdentifier.MAIN) + main.roof_construction_type = None + main.roof_insulation_thickness = "50mm" + + # Act + recommendation: Recommendation | None = recommend_roof_insulation( + baseline, _StubProducts() + ) + + # Assert + assert recommendation is not None + option = recommendation.options[0] + assert option.measure_type == "loft_insulation" + simulated: EpcPropertyData = apply_simulations(baseline, [option.overlay]) + assert ( + _part(simulated, BuildingPartIdentifier.MAIN).roof_insulation_thickness == 300 + ) + + def test_loft_option_carries_cost_from_roof_area_and_product() -> None: # Arrange baseline: EpcPropertyData = build_epc() # MAIN roof area 14.85 m^2