From 8f7a34470767ae4383abc941924959f79d1f7149 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 14:02:48 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20a=20landlord=20from-main-gas=20water-?= =?UTF-8?q?heating=20override=20to=20its=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) --- .../water_heating_overlay.py | 22 +++++++++++++++++++ .../domain/epc/test_water_heating_overlay.py | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 domain/epc/property_overlays/water_heating_overlay.py create mode 100644 tests/domain/epc/test_water_heating_overlay.py diff --git a/domain/epc/property_overlays/water_heating_overlay.py b/domain/epc/property_overlays/water_heating_overlay.py new file mode 100644 index 00000000..b65db1b1 --- /dev/null +++ b/domain/epc/property_overlays/water_heating_overlay.py @@ -0,0 +1,22 @@ +"""Map a Landlord-Override water-heating value to a heating Simulation Overlay. + +A water-heating value is one canonical ", " description ("From main +system, mains gas", "Electric immersion, electricity"). The calculator reads the +hot-water arrangement from `sap_heating.water_heating_code` (the SAP Table 4a +system code) and `water_heating_fuel`, so the overlay decomposes the value into +those two int codes and emits a whole-dwelling `HeatingOverlay` (water heating is +not per-building-part, so `building_part` is ignored). It composes field-wise with +the main_fuel / main_heating overlays. Unresolvable values produce no overlay. +""" + +from __future__ import annotations + +from typing import Optional + +from domain.modelling.simulation import EpcSimulation + + +def water_heating_overlay_for( + water_heating_value: str, building_part: int +) -> Optional[EpcSimulation]: + raise NotImplementedError diff --git a/tests/domain/epc/test_water_heating_overlay.py b/tests/domain/epc/test_water_heating_overlay.py new file mode 100644 index 00000000..f9379184 --- /dev/null +++ b/tests/domain/epc/test_water_heating_overlay.py @@ -0,0 +1,22 @@ +"""The Landlord-Override water-heating → heating Simulation Overlay mapping. + +A water-heating value resolves to the SAP `water_heating_code` (system) and +`water_heating_fuel` the calculator reads; the overlay is whole-dwelling. +""" + +from __future__ import annotations + +from domain.epc.property_overlays.water_heating_overlay import ( + water_heating_overlay_for, +) + + +def test_from_main_system_mains_gas_overlays_water_heating() -> None: + # Act + simulation = water_heating_overlay_for("From main system, mains gas", 0) + + # Assert — "from main system" is water_heating_code 901, mains gas fuel 26. + assert simulation is not None + assert simulation.heating is not None + assert simulation.heating.water_heating_code == 901 + assert simulation.heating.water_heating_fuel == 26