mirror of
https://github.com/VikParuchuri/surya.git
synced 2026-06-04 21:03:53 +08:00
17 lines
636 B
Python
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)
|