From 1a81817d7fc248754df84fe9f1f9ff8b0546016d Mon Sep 17 00:00:00 2001 From: LLLin000 <809867916@qq.com> Date: Sat, 4 Jul 2026 16:06:06 +0800 Subject: [PATCH] test: add OCR pipeline v3 parity gate --- tests/test_ocr_pipeline_v3.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_ocr_pipeline_v3.py b/tests/test_ocr_pipeline_v3.py index 3c36ef58..f5319ebf 100644 --- a/tests/test_ocr_pipeline_v3.py +++ b/tests/test_ocr_pipeline_v3.py @@ -179,3 +179,24 @@ def test_post_match_normalize_commits_shadow_role_back_to_public_role(monkeypatc assert out_rows[0]["role_candidate"] == "figure_caption_candidate" assert out_rows[0]["role_source"] == "shadow_post_match" assert doc is not None + + + +def test_build_structured_blocks_legacy_default_still_matches_seed_contract() -> None: + from paperforge.worker.ocr_blocks import build_structured_blocks + + raw_blocks = [ + { + "paper_id": "test_paper", + "block_id": "r1", + "page": 1, + "raw_label": "text", + "text": "Minimal body text.", + "bbox": [100, 100, 420, 140], + } + ] + + rows, _ = build_structured_blocks(raw_blocks) + + assert rows[0]["role"] + assert rows[0]["seed_role"] \ No newline at end of file