mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-22 08:48:38 +00:00
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
"""The Landlord-Override main-heating-system → heating Simulation Overlay mapping.
|
|
|
|
A main-heating-system value resolves to the SAP `sap_main_heating_code` the
|
|
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,
|
|
)
|
|
|
|
|
|
def test_gas_combi_overlays_the_primary_heating_code() -> None:
|
|
# Act
|
|
simulation = main_heating_overlay_for("Gas boiler, combi", 0)
|
|
|
|
# Assert — condensing combi is SAP Table 4b code 104.
|
|
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
|