Slice 19b: drop loose-tolerance fuel cost tests (superseded by pin)

Removes `test_000474_cert_to_inputs_fuel_cost_within_existing_e2e_
tolerance` (rel=0.15) and `test_000490_cert_to_inputs_fuel_cost_
closes_to_within_5pct` (rel=0.05) — both subsumed by
`test_sap_result_pin[000474-total_fuel_cost_gbp]` and
`test_sap_result_pin[000490-total_fuel_cost_gbp]` at abs=1e-4 in
test_e2e_elmhurst_sap_score.py.

The previous tolerances allowed ~£70 / £40 drift from PDF — a
fictional pass gate for a deterministic test vector. Replacement
pins surface the real residuals as named failing cases (both
currently failing, see slice 19a scoreboard).

Unused `_w000474` import dropped. test_fuel_cost.py keeps 6 unit
tests for the §10a helper itself (synthetic inputs / clamp /
off-peak split / single-row end-uses).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-22 22:31:23 +00:00
parent 6bfb0614aa
commit 4c2f37f68d

View file

@ -10,7 +10,6 @@ import pytest
from domain.sap.rdsap.cert_to_inputs import cert_to_inputs
from domain.sap.worksheet.fuel_cost import FuelCostResult, fuel_cost
from domain.sap.worksheet.tests import _elmhurst_worksheet_000474 as _w000474
def test_single_rate_main_only_bills_kwh_at_high_rate_price() -> None:
@ -347,41 +346,8 @@ def test_total_cost_clamps_to_zero_when_pv_credit_exceeds_consumption() -> None:
assert result.pv_credit_gbp < 0.0
def test_000474_cert_to_inputs_fuel_cost_within_existing_e2e_tolerance() -> None:
"""Cert-round-trip conformance: 000474 mid-terrace combi-gas (PDF
total fuel cost £655.69). Post-§10a actual lands at ~£726 (+10.7%
over PDF) because §4 HW kWh overestimates by +14% (2622 vs 2292) +
Appendix L lighting overestimates by ~3x (528 vs ~169 back-derived
from PDF). The pre-§10a £651.85 close-match was a coincidence
wrong-prices-but-cancels-kWh; post-§10a is right-prices-but-
exposes-kWh-overshoot. See `project_section_4_hw_next_ticket`
memory §4 HW worksheet tightening is the next ticket. Tolerance
mirrors the existing e2e 15% ceiling (test_e2e_elmhurst_sap_score)
until upstream §4/Appendix L slices land."""
# Arrange
epc = _w000474.build_epc()
# Act
inputs = cert_to_inputs(epc)
# Assert
assert inputs.fuel_cost.total_cost_gbp == pytest.approx(655.6949, rel=0.15)
def test_000490_cert_to_inputs_fuel_cost_closes_to_within_5pct() -> None:
"""Cert-round-trip conformance: 000490 mid-terrace combi-gas with PV
(PDF total fuel cost £807.54). Pre-§10a was £706.23 (-12.5%)
handover blamed pre-amendment spec-version drift but the real cause
was wrong-table (Table 12 vs Table 32) + missing (251) standing
charges. Post-§10a actual lands at ~£776 (-3.9%); tightens further
when §4 HW closes. Marquee zero-error closure for this fixture."""
# Arrange
from domain.sap.worksheet.tests import _elmhurst_worksheet_000490 as _w000490
epc = _w000490.build_epc()
# Act
inputs = cert_to_inputs(epc)
# Assert
assert inputs.fuel_cost.total_cost_gbp == pytest.approx(807.5421, rel=0.05)
# 000474 / 000490 fuel-cost conformance tests removed — superseded by
# the strict `test_sap_result_pin[<fixture>-total_fuel_cost_gbp]` cases
# in test_e2e_elmhurst_sap_score.py at abs=1e-4. The previous rel=0.15
# (000474) and rel=0.05 (000490) tolerances permitted ~£70/£40 drift
# from PDF — a fictional pass gate for a deterministic test vector.