From 64e31742b337f1cd2cfa4ead912148f84ea98426 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 14 Jul 2026 15:17:56 +0000 Subject: [PATCH] =?UTF-8?q?Strict-raise=20on=20an=20unrecognised=20PasHub?= =?UTF-8?q?=20main-heating=20emitter=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 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index 53917b864..862f301af 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -858,3 +858,25 @@ class TestPasHubUnmappedMainFuel: # Assert assert result.sap_heating.main_heating_details[0].main_fuel_type == 30 + + +class TestPasHubUnmappedHeatEmitter: + """A PasHub survey whose surveyed main-heating emitter label the mapper does + not yet cover must strict-raise `UnmappedPasHubLabel` at the boundary, + naming the label — so a coverage gap is fixed here (a one-line lookup + addition) rather than passed downstream as a raw string to resurface as the + calculator's `UnmappedSapCode: heat_emitter_type`. + """ + + def test_unrecognised_emitter_label_raises_naming_the_label(self) -> None: + # Arrange — an example fixture whose emitter cell carries a label the + # Elmhurst emitter map does not cover. + from datatypes.epc.domain.mapper import UnmappedPasHubLabel + + raw = load("pashub_rdsap_site_notes_example1.json") + raw["heating_and_hot_water"]["main_heating"]["emitter"] = "Skirting heaters" + survey = from_dict(PasHubRdSapSiteNotes, raw) + + # Act / Assert + with pytest.raises(UnmappedPasHubLabel, match="Skirting heaters"): + EpcPropertyDataMapper.from_site_notes(survey)