From a117e61b31d665a85c66fa80152b4eda2f1cba61 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 14:03:25 +0000 Subject: [PATCH] =?UTF-8?q?Decode=20more=20water-heating=20system/fuel=20o?= =?UTF-8?q?verrides=20to=20their=20codes=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../domain/epc/test_water_heating_overlay.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/domain/epc/test_water_heating_overlay.py b/tests/domain/epc/test_water_heating_overlay.py index f93791843..49cfffbf2 100644 --- a/tests/domain/epc/test_water_heating_overlay.py +++ b/tests/domain/epc/test_water_heating_overlay.py @@ -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