Decode regular/CPSU/storage/direct-electric heating overrides 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-19 14:05:39 +00:00
parent d6bde062ed
commit 2ede859158

View file

@ -6,6 +6,8 @@ calculator reads from the primary system; the overlay is whole-dwelling.
from __future__ import annotations
import pytest
from domain.epc.property_overlays.main_heating_system_overlay import (
main_heating_overlay_for,
)
@ -19,3 +21,41 @@ def test_gas_combi_overlays_the_primary_heating_code() -> None:
assert simulation is not None
assert simulation.heating is not None
assert simulation.heating.sap_main_heating_code == 104
@pytest.mark.parametrize(
("main_heating_value", "code"),
[
("Gas boiler, regular", 102),
("Gas CPSU", 120),
("Electric storage heaters, fan", 404),
("Direct-acting electric", 191),
],
)
def test_heating_archetypes_decode_to_their_sap_codes(
main_heating_value: str, code: int
) -> None:
# Act
simulation = main_heating_overlay_for(main_heating_value, 0)
# Assert
assert simulation is not None
assert simulation.heating is not None
assert simulation.heating.sap_main_heating_code == code
@pytest.mark.parametrize(
"main_heating_value",
["Unknown", "", "Air source heat pump", "Community heating"],
)
def test_unresolvable_or_unmodelled_heating_produces_no_overlay(
main_heating_value: str,
) -> None:
# Heat pumps (main_heating_index_number) and community heating (community
# codes) don't map to a Table 4b sap_main_heating_code yet — no overlay.
# Act
simulation = main_heating_overlay_for(main_heating_value, 0)
# Assert
assert simulation is None