lllin000_PaperForge/tests/test_ocr_figure_vnext_compare.py
2026-07-03 12:35:33 +08:00

17 lines
793 B
Python

from __future__ import annotations
from paperforge.worker.ocr_figures import build_figure_inventory_legacy, build_figure_inventory_vnext
from scripts.dev.compare_figure_inventory_legacy_vs_vnext import compare_inventories
def test_compare_inventories_reports_counts_for_same_page_case():
blocks = [
{"block_id": "c1", "page": 1, "role": "figure_caption", "text": "Figure 1. Caption", "bbox": [0, 100, 200, 150]},
{"block_id": "a1", "page": 1, "role": "figure_asset", "bbox": [0, 0, 200, 90], "raw_label": "image"},
]
legacy = build_figure_inventory_legacy(blocks, 1200)
vnext = build_figure_inventory_vnext(blocks, 1200)
diff = compare_inventories(legacy, vnext)
assert diff["vnext_matched_count"] >= 1
assert "vnext_consumed_block_ids" in diff