The overlay logs an error when it cannot complete a heating companion set 🟥

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-03 09:15:31 +00:00
parent ffd21689fd
commit ea113b58fb

View file

@ -6,6 +6,8 @@ calculator reads from the primary system; the overlay is whole-dwelling.
from __future__ import annotations
import logging
import pytest
from domain.epc.property_overrides.main_heating_system_type import MainHeatingSystemType
@ -90,6 +92,22 @@ 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,
) -> None:
# An archetype the overlay cannot yet fully companion — here an air-source
# heat pump, whose Table 4e Group 2 conservative control is not yet mapped —
# is still overlaid (log-and-continue), but the incomplete companion set is
# logged as an error so the known gap is visible (CloudWatch) rather than
# silently inheriting the replaced system's stale value.
# Act
with caplog.at_level(logging.ERROR):
main_heating_overlay_for("Air source heat pump", 0)
# Assert — the gap is reported and names the archetype.
assert "Air source heat pump" in caplog.text
@pytest.mark.parametrize(
("main_heating_value", "code"),
[