Slice 81: RED tracer-bullet diff test for cohort 000490

Mirror the pattern from cohorts 000474/000477/000480/000487 for cert
U985-0001-000490 (End-Terrace, main + 1 extension, gas combi + gas-
secondary heating, sheltered_sides=1 per RdSAP §S5). RED with 32
load-bearing divergences — Cat A descriptive fields + end-terrace
dwelling_type + extensions_count + sap_windows LEN 6 vs 3. Closes
via Slice 82 (Cat A) + Slice 83 (window expansion).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-25 18:07:48 +00:00
parent 1f271ca891
commit 3079153113

View file

@ -43,6 +43,7 @@ from domain.sap.worksheet.tests import (
_elmhurst_worksheet_000477 as _w000477,
_elmhurst_worksheet_000480 as _w000480,
_elmhurst_worksheet_000487 as _w000487,
_elmhurst_worksheet_000490 as _w000490,
)
_FIXTURES = Path(__file__).parent / "fixtures"
@ -661,3 +662,33 @@ def test_from_elmhurst_site_notes_matches_hand_built_000487() -> None:
f"hand-built EpcPropertyData for cohort cert 000487:\n " +
"\n ".join(diffs)
)
def test_from_elmhurst_site_notes_matches_hand_built_000490() -> None:
# Arrange — _elmhurst_worksheet_000490.build_epc() is the canonical
# hand-built EpcPropertyData for cert U985-0001-000490 (End-Terrace,
# main + 1 extension, gas combi + gas-secondary; sheltered_sides=1
# per RdSAP §S5); it cascades to the worksheet PDF's `SAP value
# 57.3979` at 1e-4. Routing the Summary PDF through the Elmhurst
# mapper MUST produce a load-bearing-field-equivalent
# EpcPropertyData; any divergence is a mapper-coverage gap.
pages = _summary_pdf_to_textract_style_pages(_SUMMARY_000490_PDF)
site_notes = ElmhurstSiteNotesExtractor(pages).extract()
mapped = EpcPropertyDataMapper.from_elmhurst_site_notes(site_notes)
hand_built = _w000490.build_epc()
# Act
diffs: list[str] = []
for field_name in _LOAD_BEARING_FIELDS:
diffs.extend(_diff_load_bearing(
getattr(mapped, field_name, None),
getattr(hand_built, field_name, None),
field_name,
))
# Assert
assert not diffs, (
f"{len(diffs)} load-bearing divergence(s) between mapped and "
f"hand-built EpcPropertyData for cohort cert 000490:\n " +
"\n ".join(diffs)
)