Remap every window's glazing from a landlord glazing override 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-19 13:21:06 +00:00
parent 5a1cf28892
commit 8ce22a5ccb

View file

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