From 1925cdd65d68cc03f7b505da69d81e240ae75fc1 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 3 Jul 2026 14:21:34 +0000 Subject: [PATCH] =?UTF-8?q?An=20incomplete=20heating=20companion=20set=20r?= =?UTF-8?q?aises=20instead=20of=20logging=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 --- .../epc/test_main_heating_system_overlay.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/domain/epc/test_main_heating_system_overlay.py b/tests/domain/epc/test_main_heating_system_overlay.py index fb856b75c..ec9e978aa 100644 --- a/tests/domain/epc/test_main_heating_system_overlay.py +++ b/tests/domain/epc/test_main_heating_system_overlay.py @@ -92,27 +92,24 @@ def test_electric_room_heaters_overlay_the_room_heater_charge_control() -> None: assert simulation.heating.main_heating_control == 2601 -def test_overlay_logs_when_it_cannot_complete_a_companion_set( - caplog: pytest.LogCaptureFixture, +def test_overlay_raises_on_an_incomplete_companion_set( monkeypatch: pytest.MonkeyPatch, ) -> None: - # Every real archetype now resolves a complete companion set (ADR-0053), - # so the incomplete case is simulated: a hypothetical warm-air heat-pump - # archetype (SAP 521 — category 4 but its Table 4e Group 5 control is - # deliberately unmapped). The overlay still applies (log-and-continue), - # but the incomplete companion set is reported rather than silently - # inheriting the replaced system's stale value. + # Every real archetype resolves a complete companion set, so the + # log-and-continue mitigation has no remaining population and the + # ADR-0048 end-state applies: an incomplete set FAILS LOUDLY instead of + # shipping a silently-incoherent cert (ADR-0053, #1444 Part C). Simulated + # with a hypothetical warm-air heat-pump archetype (SAP 521 — category 4 + # but its Table 4e Group 5 control is deliberately unmapped): a future + # archetype cannot land without choosing its companions. from domain.epc.property_overlays import main_heating_system_overlay as mod monkeypatch.setitem(mod._MAIN_HEATING_CODES, "Warm-air heat pump", 521) - # Act - with caplog.at_level(logging.ERROR): + # Act / Assert — the raise names the archetype. + with pytest.raises(ValueError, match="Warm-air heat pump"): main_heating_overlay_for("Warm-air heat pump", 0) - # Assert — the gap is reported and names the archetype. - assert "Warm-air heat pump" in caplog.text - @pytest.mark.parametrize( "main_heating_value",