From 168c610adec8ebea4183cd4ba05ad103547cafa9 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 14 Jul 2026 16:23:19 +0000 Subject: [PATCH] =?UTF-8?q?Strict-raise=20on=20an=20unrecognised=20PasHub?= =?UTF-8?q?=20main-heating=20control=20label=20=F0=9F=9F=A9?= 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 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index 96e5620e5..1ef7569d9 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -926,3 +926,23 @@ class TestPasHubMainHeatingControlCoding: # Act / Assert assert _control_type(main) == control_type + + def test_unrecognised_control_label_raises_naming_the_label(self) -> None: + # Arrange — a Controls label the boiler table does not cover (e.g. the + # cohort's lone community-charging control). It must strict-raise + # `UnmappedPasHubLabel` at the boundary, naming the label, so the gap is + # a one-line lookup addition here rather than a raw string resurfacing + # as the calculator's `UnmappedSapCode`. + from datatypes.epc.domain.mapper import UnmappedPasHubLabel + + raw = load("pashub_rdsap_site_notes_example1.json") + raw["heating_and_hot_water"]["main_heating"][ + "controls" + ] = "Charging system linked to use of community heating" + survey = from_dict(PasHubRdSapSiteNotes, raw) + + # Act / Assert + with pytest.raises( + UnmappedPasHubLabel, match="Charging system linked to use of community" + ): + EpcPropertyDataMapper.from_site_notes(survey)