Resolve a landlord from-main-gas water-heating override to its 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:02:48 +00:00
parent 89bb075ce6
commit 8f7a344707
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,22 @@
"""Map a Landlord-Override water-heating value to a heating Simulation Overlay.
A water-heating value is one canonical "<system>, <fuel>" 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

View file

@ -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