Preserve PasHub blank-Fuel electric-system inference through fuel-code normalization 🟪

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-14 14:34:28 +00:00
parent a8afcd1b3d
commit b91763fc1d

View file

@ -842,3 +842,20 @@ class TestPasHubUnmappedMainFuel:
# Act / Assert
with pytest.raises(UnmappedPasHubLabel, match="Anthracite"):
EpcPropertyDataMapper.from_site_notes(survey)
def test_blank_fuel_electric_system_resolves_to_electricity_code(self) -> None:
# Arrange — an all-electric system whose surveyed Fuel cell is blank;
# the existing electric-system inference must survive normalization and
# emit the standard-electricity SAP fuel code (30), not the label.
raw = load("pashub_rdsap_site_notes_example1.json")
raw["heating_and_hot_water"]["main_heating"]["fuel"] = ""
raw["heating_and_hot_water"]["main_heating"][
"system_type"
] = "Electric storage heaters"
survey = from_dict(PasHubRdSapSiteNotes, raw)
# Act
result = EpcPropertyDataMapper.from_site_notes(survey)
# Assert
assert result.sap_heating.main_heating_details[0].main_fuel_type == 30