Files
wehub-resource-sync 925e56bb5f
Test CLI scripts / build (push) Waiting to run
Unit tests / build (t4_gpu) (push) Waiting to run
Unit tests / build (ubuntu-latest) (push) Waiting to run
Unit tests / build (windows-latest) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:24:56 +08:00

17 lines
636 B
Python

def test_recognition(recognition_predictor, layout_predictor, test_image):
layouts = layout_predictor([test_image])
if layouts[0].error:
# Server unavailable in test env — skip silently
return
page_results = recognition_predictor([test_image], layouts)
assert len(page_results) == 1
assert page_results[0].image_bbox == [0, 0, 1024, 1024]
blocks = page_results[0].blocks
# Each layout box should produce one block (skipped or otherwise)
assert len(blocks) == len(layouts[0].bboxes)
for blk in blocks:
assert blk.reading_order >= 0
assert isinstance(blk.html, str)