Strict-raise a PasHub control label on a non-boiler system 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-14 17:46:23 +00:00
parent aa69462b5b
commit 313ae5253a

View file

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