diff --git a/datatypes/epc/domain/tests/test_from_sap_schema.py b/datatypes/epc/domain/tests/test_from_sap_schema.py index ec9981009..957cc4a44 100644 --- a/datatypes/epc/domain/tests/test_from_sap_schema.py +++ b/datatypes/epc/domain/tests/test_from_sap_schema.py @@ -870,6 +870,27 @@ class TestFullSapSchema16xRouting: assert epc.door_count == 1 assert epc.dwelling_type == "Detached house" + def test_full_sap_16_x_electricity_tariff_is_translated_not_passed_through( + self, + ) -> None: + # A full-SAP 16.x cert lodges the SAP `energy_tariff` code space, not the + # RdSAP `meter_type` one. Routing it through the full-SAP mapper (via the + # assessment_type=SAP gate) must apply `_sap_17_1_meter_type`: tariff 1 = + # standard → STANDARD. Were it raw-passed to the RdSAP normaliser, code 1 + # = "dual" → SEVEN_HOUR (the prime-lead over-rating bug this guards). + from domain.sap10_calculator.tables.table_12a import ( + Tariff, + tariff_from_meter_type, + ) + + data = load("sap_16_0_full.json") # electricity_tariff = 1 (standard) + + epc = EpcPropertyDataMapper.from_api_response(data) + + assert tariff_from_meter_type(epc.sap_energy_source.meter_type) is ( + Tariff.STANDARD + ) + def test_reduced_16_x_cert_unaffected_by_full_sap_routing(self) -> None: # Arrange — a reduced 16.2 cert (assessment_type RdSAP) must stay on the # RdSAP path, keeping its top-level property_type.