Recommend loft insulation for a loft below the building-regs depth 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-10 16:03:39 +00:00
parent ce0940c335
commit 2fe5b79dc4

View file

@ -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