mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Lock full-SAP 16.x tariff translation via the assessment_type gate 🟩
Confirming regression test for the prime-lead suspicion (SAP-16.x meter over-rating). A full-SAP-shaped 16.x cert lodges the SAP energy_tariff code space; the assessment_type=SAP gate routes it to the full-SAP mapper, which translates the code (1=standard → STANDARD) rather than raw-passing it to the RdSAP normaliser (where 1="dual" → SEVEN_HOUR, the over-rating bug). No fix needed — the gate already prevents the drop; this pins that behaviour. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7866b4a34c
commit
450ecfb9b4
1 changed files with 21 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue