From 30791531133d5d2f55d1a1f9940a50e21b7aec52 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 25 May 2026 18:07:48 +0000 Subject: [PATCH] Slice 81: RED tracer-bullet diff test for cohort 000490 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../tests/test_summary_pdf_mapper_chain.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py b/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py index 56659081..0beb9ff1 100644 --- a/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py +++ b/backend/documents_parser/tests/test_summary_pdf_mapper_chain.py @@ -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) + )