feat add glm-ocr core
This commit is contained in:
31
tests/schemas/test_image.py
Normal file
31
tests/schemas/test_image.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from app.schemas.image import ImageOCRRequest, LayoutRegion
|
||||
|
||||
|
||||
def test_layout_region_native_label_defaults_to_empty_string():
|
||||
region = LayoutRegion(
|
||||
type="text",
|
||||
bbox=[0, 0, 10, 10],
|
||||
confidence=0.9,
|
||||
score=0.9,
|
||||
)
|
||||
|
||||
assert region.native_label == ""
|
||||
|
||||
|
||||
def test_layout_region_exposes_native_label_when_provided():
|
||||
region = LayoutRegion(
|
||||
type="text",
|
||||
native_label="doc_title",
|
||||
bbox=[0, 0, 10, 10],
|
||||
confidence=0.9,
|
||||
score=0.9,
|
||||
)
|
||||
|
||||
assert region.native_label == "doc_title"
|
||||
|
||||
|
||||
def test_image_ocr_request_requires_exactly_one_input():
|
||||
request = ImageOCRRequest(image_url="https://example.com/test.png")
|
||||
|
||||
assert request.image_url == "https://example.com/test.png"
|
||||
assert request.image_base64 is None
|
||||
Reference in New Issue
Block a user