mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Code PAS Hub Bulk LPG and Mains Gas main-fuel labels to SAP codes 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f7e6bf1184
commit
c489dfcb29
1 changed files with 33 additions and 0 deletions
|
|
@ -188,6 +188,39 @@ class TestGlazingTypeCoding:
|
|||
EpcPropertyDataMapper.from_site_notes(survey)
|
||||
|
||||
|
||||
class TestMainFuelCoding:
|
||||
"""`from_site_notes` must int-code the PAS Hub main-heating `fuel` label to the
|
||||
SAP10 fuel code the calculator's cascade routes via, not copy the raw label. A
|
||||
raw label reaches the calculator as `MissingMainFuelType`; an unmapped one
|
||||
strict-raises `UnmappedPasHubLabel` at the boundary. `Bulk LPG` was the last
|
||||
residual label parse-raising in the Guinness cohort (issue #1558); `Mains Gas`
|
||||
is the capitalised variant the newer `Fuel:` site-note form lodges.
|
||||
"""
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"label, expected_code",
|
||||
[
|
||||
("Mains gas", 26), # standard mains-gas fuel code (landed #1554)
|
||||
("Mains Gas", 26), # `Fuel:` form capitalisation variant → same code
|
||||
("Bulk LPG", 27), # bulk LPG (Table 32 code 2), matches Elmhurst map
|
||||
("Electricity", 30), # standard-electricity fuel code
|
||||
],
|
||||
)
|
||||
def test_label_maps_to_sap_code(self, label: str, expected_code: int) -> None:
|
||||
data = load("pashub_rdsap_site_notes_example1.json")
|
||||
data["heating_and_hot_water"]["main_heating"]["fuel"] = label
|
||||
survey = from_dict(PasHubRdSapSiteNotes, data)
|
||||
result = EpcPropertyDataMapper.from_site_notes(survey)
|
||||
assert result.sap_heating.main_heating_details[0].main_fuel_type == expected_code
|
||||
|
||||
def test_unknown_label_strict_raises(self) -> None:
|
||||
data = load("pashub_rdsap_site_notes_example1.json")
|
||||
data["heating_and_hot_water"]["main_heating"]["fuel"] = "Fusion reactor"
|
||||
survey = from_dict(PasHubRdSapSiteNotes, data)
|
||||
with pytest.raises(UnmappedPasHubLabel):
|
||||
EpcPropertyDataMapper.from_site_notes(survey)
|
||||
|
||||
|
||||
class TestFromSiteNotesExample1:
|
||||
"""
|
||||
Fixture: pashub_rdsap_site_notes_example1.json
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue