diff --git a/tests/domain/epc_prediction/test_historic_conditioning.py b/tests/domain/epc_prediction/test_historic_conditioning.py index 8f26febb1..886319b64 100644 --- a/tests/domain/epc_prediction/test_historic_conditioning.py +++ b/tests/domain/epc_prediction/test_historic_conditioning.py @@ -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(