Rate heat-network charging controls 2306/2314/2313 per Table 4e Group 3 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-16 15:57:39 +00:00
parent 9d761f6ad1
commit f135e96e2e

View file

@ -2661,6 +2661,54 @@ class TestPasHubMainHeatingControlCoding:
assert main.main_heating_control == 2308
assert _control_type(main) == 2
@pytest.mark.parametrize(
"label, code, control_type",
[
# Linked-to-use charging (DHW factor 1.00) with TRVs → type 3.
(
"Charging system linked to use of community heating, "
"programmer and TRVs",
2306,
3,
),
(
"Charging system linked to use of community heating, "
"room thermostat and TRVs",
2314,
3,
),
# Flat-rate charging (DHW factor 1.05) with thermostat + TRVs
# → type 2.
("Flat rate charging, room thermostat and TRVs", 2313, 2),
],
)
def test_heat_network_charging_control_maps_to_group3_code(
self, label: str, code: int, control_type: int
) -> None:
# Arrange — a complete Table 4e Group 3 community lodgement with the
# charging-control label under test.
from domain.sap10_calculator.rdsap.cert_to_inputs import (
_control_type, # pyright: ignore[reportPrivateUsage]
)
raw = load("pashub_rdsap_site_notes_example1.json")
mh = raw["heating_and_hot_water"]["main_heating"]
mh["system_type"] = "Community heating system"
mh["community_heat_source"] = "Community heating - boilers only"
mh["fuel"] = "Mains Gas"
mh["product_id"] = 0
mh["controls"] = label
survey = from_dict(PasHubRdSapSiteNotes, raw)
# Act
main = EpcPropertyDataMapper.from_site_notes(
survey
).sap_heating.main_heating_details[0]
# Assert
assert main.main_heating_control == code
assert _control_type(main) == control_type
def test_heat_network_unmapped_control_label_strict_raises(self) -> None:
# A community-system control label the Group 3 lookup does not cover
# strict-raises (naming label + system), never silently mis-rating.