Decode more water-heating system/fuel overrides to their codes 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-19 14:03:25 +00:00
parent 7d70c1d298
commit a117e61b31

View file

@ -6,6 +6,8 @@ A water-heating value resolves to the SAP `water_heating_code` (system) and
from __future__ import annotations
import pytest
from domain.epc.property_overlays.water_heating_overlay import (
water_heating_overlay_for,
)
@ -20,3 +22,34 @@ def test_from_main_system_mains_gas_overlays_water_heating() -> None:
assert simulation.heating is not None
assert simulation.heating.water_heating_code == 901
assert simulation.heating.water_heating_fuel == 26
@pytest.mark.parametrize(
("water_heating_value", "code", "fuel"),
[
("From main system, electricity", 901, 29),
("Electric immersion, electricity", 903, 29),
],
)
def test_water_heating_systems_decode_to_their_codes(
water_heating_value: str, code: int, fuel: int
) -> None:
# Act
simulation = water_heating_overlay_for(water_heating_value, 0)
# Assert
assert simulation is not None
assert simulation.heating is not None
assert simulation.heating.water_heating_code == code
assert simulation.heating.water_heating_fuel == fuel
@pytest.mark.parametrize("water_heating_value", ["Unknown", ""])
def test_unresolvable_water_heating_produces_no_overlay(
water_heating_value: str,
) -> None:
# Act
simulation = water_heating_overlay_for(water_heating_value, 0)
# Assert
assert simulation is None