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)