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