mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
An incomplete heating companion set raises instead of logging 🟥
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
61f9a63b66
commit
1925cdd65d
1 changed files with 10 additions and 13 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue