From 8ce22a5ccb35fecbf1249d4922b62a8052cf3a9e Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 13:21:06 +0000 Subject: [PATCH] =?UTF-8?q?Remap=20every=20window's=20glazing=20from=20a?= =?UTF-8?q?=20landlord=20glazing=20override=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) --- tests/domain/epc/test_glazing_overlay.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/domain/epc/test_glazing_overlay.py b/tests/domain/epc/test_glazing_overlay.py index 9668e3aa..d65220e7 100644 --- a/tests/domain/epc/test_glazing_overlay.py +++ b/tests/domain/epc/test_glazing_overlay.py @@ -10,6 +10,10 @@ from __future__ import annotations import pytest from domain.epc.property_overlays.glazing_overlay import glazing_overlay_for +from domain.modelling.scoring.overlay_applicator import apply_simulations +from tests.domain.sap10_calculator.worksheet._elmhurst_worksheet_000490 import ( + build_epc, +) def test_double_glazing_post_2002_overlays_its_glazing_code() -> None: @@ -50,3 +54,20 @@ def test_unresolvable_glazing_produces_no_overlay(glazing_value: str) -> None: # Assert assert simulation is None + + +def test_glazing_override_remaps_every_window_and_clears_lodged_u() -> None: + # Arrange — baseline windows are double glazed (code 2, lodged U 2.8); the + # landlord corrects the whole dwelling to single glazing. + baseline = build_epc() + assert len(baseline.sap_windows) > 1 + overlay = glazing_overlay_for("Single glazing", 0) + assert overlay is not None + + # Act + result = apply_simulations(baseline, [overlay]) + + # Assert — every window flips to single (code 1) and its lodged transmission + # U is cleared so the Table-24 cascade re-derives U from the new type. + assert all(w.glazing_type == 1 for w in result.sap_windows) + assert all(w.window_transmission_details is None for w in result.sap_windows)