-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_crop_integration.py
More file actions
31 lines (23 loc) · 968 Bytes
/
test_crop_integration.py
File metadata and controls
31 lines (23 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import pytest
from mindee import ClientV2, PathInput
from mindee.v2 import CropParameters, CropResponse
from tests.utils import V2_PRODUCT_DATA_DIR
@pytest.fixture(scope="session")
def crop_model_id() -> str:
"""Identifier of the Financial Document model, supplied through an env var."""
return os.getenv("MINDEE_V2_SE_TESTS_CROP_MODEL_ID")
@pytest.fixture(scope="session")
def v2_client() -> ClientV2:
return ClientV2()
@pytest.mark.integration
@pytest.mark.v2
def test_crop_default_sample(v2_client: ClientV2, crop_model_id: str):
input_source = PathInput(V2_PRODUCT_DATA_DIR / "crop" / "default_sample.jpg")
response = v2_client.enqueue_and_get_result(
CropResponse, input_source, CropParameters(crop_model_id)
)
assert response.inference is not None
assert response.inference.file.name == "default_sample.jpg"
assert response.inference.result.crops
assert len(response.inference.result.crops) == 2