From e71df5df99f38773db56c2bd5c18c32f92b8fbcb Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 13:43:28 +0000 Subject: [PATCH] =?UTF-8?q?Re-date=20a=20building=20part's=20EPC=20age=20b?= =?UTF-8?q?and=20from=20a=20landlord=20override=20=F0=9F=9F=A9?= 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_construction_age_band_overlay.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/domain/epc/test_construction_age_band_overlay.py b/tests/domain/epc/test_construction_age_band_overlay.py index bb66933e..7527b9ea 100644 --- a/tests/domain/epc/test_construction_age_band_overlay.py +++ b/tests/domain/epc/test_construction_age_band_overlay.py @@ -13,6 +13,14 @@ from datatypes.epc.domain.epc_property_data import BuildingPartIdentifier from domain.epc.property_overlays.construction_age_band_overlay import ( age_band_overlay_for, ) +from domain.modelling.scoring.overlay_applicator import apply_simulations +from tests.domain.sap10_calculator.worksheet._elmhurst_worksheet_000490 import ( + build_epc, +) + + +def _part(epc, identifier): # type: ignore[no-untyped-def] + return next(p for p in epc.sap_building_parts if p.identifier is identifier) def test_age_band_overlays_the_main_building_part() -> None: @@ -58,3 +66,21 @@ def test_unrecognised_age_band_produces_no_overlay(age_band_value: str) -> None: # Assert assert simulation is None + + +def test_age_band_override_re_dates_the_main_part_only() -> None: + # Arrange — baseline main + extension are both band B; the landlord corrects + # the main building's age band to F (1976-1982). + baseline = build_epc() + overlay = age_band_overlay_for("F", 0) + assert overlay is not None + + # Act + result = apply_simulations(baseline, [overlay]) + + # Assert — the main part is re-dated (its U-value cascade now keys on F); the + # extension is left untouched. + assert _part(result, BuildingPartIdentifier.MAIN).construction_age_band == "F" + assert ( + _part(result, BuildingPartIdentifier.EXTENSION_1).construction_age_band == "B" + )