mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Remap the primary heating system and compose the heating override trio 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
66bb29a834
commit
a6f2ae99df
1 changed files with 44 additions and 0 deletions
|
|
@ -8,9 +8,17 @@ from __future__ import annotations
|
|||
|
||||
import pytest
|
||||
|
||||
from domain.epc.property_overlays.main_fuel_overlay import fuel_overlay_for
|
||||
from domain.epc.property_overlays.main_heating_system_overlay import (
|
||||
main_heating_overlay_for,
|
||||
)
|
||||
from domain.epc.property_overlays.water_heating_overlay import (
|
||||
water_heating_overlay_for,
|
||||
)
|
||||
from domain.modelling.scoring.overlay_applicator import apply_simulations
|
||||
from tests.domain.sap10_calculator.worksheet._elmhurst_worksheet_000490 import (
|
||||
build_epc,
|
||||
)
|
||||
|
||||
|
||||
def test_gas_combi_overlays_the_primary_heating_code() -> None:
|
||||
|
|
@ -59,3 +67,39 @@ def test_unresolvable_or_unmodelled_heating_produces_no_overlay(
|
|||
|
||||
# Assert
|
||||
assert simulation is None
|
||||
|
||||
|
||||
def test_main_heating_override_remaps_the_primary_system_code() -> None:
|
||||
# Arrange
|
||||
baseline = build_epc()
|
||||
overlay = main_heating_overlay_for("Gas boiler, regular", 0)
|
||||
assert overlay is not None
|
||||
|
||||
# Act
|
||||
result = apply_simulations(baseline, [overlay])
|
||||
|
||||
# Assert — the calculator reads the code off main_heating_details[0].
|
||||
assert result.sap_heating.main_heating_details[0].sap_main_heating_code == 102
|
||||
|
||||
|
||||
def test_the_three_heating_overrides_compose_without_conflict() -> None:
|
||||
# Arrange — main_fuel, water_heating and main_heating_system all fold onto one
|
||||
# HeatingOverlay surface but set DISJOINT fields, so they compose (the
|
||||
# field-disjoint design that makes precedence moot for these three).
|
||||
baseline = build_epc()
|
||||
overlays = [
|
||||
fuel_overlay_for("electricity", 0),
|
||||
water_heating_overlay_for("Electric immersion, electricity", 0),
|
||||
main_heating_overlay_for("Electric storage heaters, fan", 0),
|
||||
]
|
||||
assert all(o is not None for o in overlays)
|
||||
|
||||
# Act
|
||||
result = apply_simulations(baseline, [o for o in overlays if o is not None])
|
||||
|
||||
# Assert — each override landed on its own field.
|
||||
main = result.sap_heating.main_heating_details[0]
|
||||
assert main.main_fuel_type == 29
|
||||
assert main.sap_main_heating_code == 404
|
||||
assert result.sap_heating.water_heating_code == 903
|
||||
assert result.sap_heating.water_heating_fuel == 29
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue