Strict-raise on an unrecognised PasHub main-heating control label 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-14 16:23:19 +00:00
parent be076bb9a4
commit 168c610ade

View file

@ -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)