diff --git a/tests/domain/epc/test_main_heating_system_overlay.py b/tests/domain/epc/test_main_heating_system_overlay.py index e1b7a90d6..1a55de61d 100644 --- a/tests/domain/epc/test_main_heating_system_overlay.py +++ b/tests/domain/epc/test_main_heating_system_overlay.py @@ -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