surya/tests/test_latex_ocr.py
Tarun Menta d4496f8caa
Some checks failed
Integration test / build (push) Has been cancelled
Unit tests / build (t4_gpu) (push) Has been cancelled
Unit tests / build (ubuntu-latest) (push) Has been cancelled
Unit tests / build (windows-latest) (push) Has been cancelled
Test CLI scripts / build (push) Has been cancelled
Fix bad test - Add real latex image
2025-08-29 14:53:41 -04:00

19 lines
549 B
Python

from typing import List
from PIL import Image, ImageDraw
from surya.common.surya.schema import TaskNames
from surya.recognition import OCRResult
def test_latex_ocr(recognition_predictor, test_image_latex):
width, height = test_image_latex.size
results: List[OCRResult] = recognition_predictor(
[test_image_latex], [TaskNames.block_without_boxes], bboxes=[[[0, 0, width, height]]]
)
text = results[0].text_lines[0].text
assert len(results) == 1
assert text.startswith("<math")
assert text.endswith("</math>")