Map sap_version on full-SAP certs so pre-SAP10 rebaseline fires 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-25 20:34:35 +00:00
parent 2d18e9a3b0
commit 14c777f37b

View file

@ -78,6 +78,24 @@ class TestFromSapSchema17_1Tracer:
assert result.total_floor_area_m2 == 68.0
class TestFromSapSchema17_1RebaselineFields:
"""The calc-affecting categoricals the WIP mapper dropped (ADR-0037). Their
absence left the full-SAP family un-rebaselined and mis-scored, producing the
portfolio-796 "impossible downgrade"."""
def test_maps_sap_version_so_pre_sap10_rebaseline_can_fire(self) -> None:
# The full-SAP family lodges SAP 2012 (sap_version 9.92). Without it on
# the EpcPropertyData, CalculatorRebaseliner cannot fire trigger (a)
# (`sap_version < 10.2` → Effective = Calculated), so Effective
# Performance wrongly stays equal to the lodged SAP-2012 score while the
# plan models the SAP-10.2 calc — the impossible downgrade.
schema = from_dict(SapSchema17_1, load("sap_17_1.json"))
result = EpcPropertyDataMapper.from_sap_schema_17_1(schema)
assert result.sap_version == 9.92
class TestFullSapHasHotWaterCylinderFallback:
"""Some full-SAP certs (e.g. SAP-Schema-17.0 cert 8265-7433-3220-9736-7902)
omit the top-level `has_hot_water_cylinder` and lodge it only under