From f135e96e2e09d68137e0757102b78efd4d0af8b4 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Thu, 16 Jul 2026 15:57:39 +0000 Subject: [PATCH] =?UTF-8?q?Rate=20heat-network=20charging=20controls=20230?= =?UTF-8?q?6/2314/2313=20per=20Table=204e=20Group=203=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../epc/domain/tests/test_from_site_notes.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index 135179038..d65bf2ee4 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -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.