Legacy register fuel descriptions resolve to modern main_fuel codes 🟥

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-06 10:03:09 +00:00
parent 2903a069ea
commit c79cd777e5

View file

@ -47,6 +47,25 @@ def test_resolves_stable_attributes_into_cohort_code_spaces():
assert conditioning.total_floor_area_m2 == 84.0
def test_legacy_register_fuel_descriptions_resolve():
# Arrange / Act / Assert — the old register lodged pre-RdSAP-17 fuels with
# a "backwards compatibility" rider or a SAP-style prefix; they name the
# same physical fuels (dominant in the pre-2012 dump: a 65-shard scan found
# 636/663 unresolved values were these variants).
cases = {
"mains gas - this is for backwards compatibility only and should not be used": 26,
"electricity - this is for backwards compatibility only and should not be used": 29,
"LPG - this is for backwards compatibility only and should not be used": 27,
"oil - this is for backwards compatibility only and should not be used": 28,
"Gas: mains gas": 26,
"Electricity: electricity, unspecified tariff": 29,
"dual fuel - mineral + wood": 10,
}
for text, code in cases.items():
record = _hist(main_fuel=text)
assert conditioning_from_historic(record).main_fuel == code, text
def test_unresolvable_values_degrade_to_none():
# Arrange — junk and blanks must never guess a code.
record = _hist(