From 313ae5253a66bc570cc7d40275d14f18333665b6 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 14 Jul 2026 17:46:23 +0000 Subject: [PATCH] =?UTF-8?q?Strict-raise=20a=20PasHub=20control=20label=20o?= =?UTF-8?q?n=20a=20non-boiler=20system=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) --- .../epc/domain/tests/test_from_site_notes.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index c6647ca82..07786b566 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -1100,6 +1100,24 @@ class TestPasHubMainHeatingControlCoding: ): EpcPropertyDataMapper.from_site_notes(survey) + def test_shared_control_label_on_non_boiler_system_strict_raises(self) -> None: + # Arrange — the boiler table's codes are SAP 10.2 Table 4e Group 1 (21xx); + # the *same* control label appears in every system group under a different + # 2xxx code (e.g. "Programmer, room thermostat and TRVs" is 2106 on a + # boiler but 2210/2306/… on a heat pump / heat network). Resolving the + # label alone would silently give a non-boiler dwelling the boiler code, + # so a non-boiler system_type must strict-raise, naming the system. + raw = load("pashub_rdsap_site_notes_example1.json") + raw["heating_and_hot_water"]["main_heating"]["system_type"] = "Heat pump" + raw["heating_and_hot_water"]["main_heating"][ + "controls" + ] = "Programmer, room thermostat and TRVs" + survey = from_dict(PasHubRdSapSiteNotes, raw) + + # Act / Assert + with pytest.raises(UnmappedPasHubLabel, match="Heat pump"): + EpcPropertyDataMapper.from_site_notes(survey) + class TestPasHubUnmappedHeatEmitter: """A PasHub survey whose surveyed main-heating emitter label the mapper does