-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_classification_response.py
More file actions
32 lines (29 loc) · 1.12 KB
/
test_classification_response.py
File metadata and controls
32 lines (29 loc) · 1.12 KB
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
32
import pytest
from mindee import LocalResponse
from mindee.v2.product.classification.classification_classifier import (
ClassificationClassifier,
)
from mindee.v2.product.classification import ClassificationInference
from mindee.v2.product.classification.classification_response import (
ClassificationResponse,
)
from mindee.v2.product.classification.classification_result import ClassificationResult
from tests.utils import V2_PRODUCT_DATA_DIR
@pytest.mark.v2
def test_classification_single():
input_inference = LocalResponse(
V2_PRODUCT_DATA_DIR / "classification" / "classification_single.json"
)
classification_response = input_inference.deserialize_response(
ClassificationResponse
)
assert isinstance(classification_response.inference, ClassificationInference)
assert isinstance(classification_response.inference.result, ClassificationResult)
assert isinstance(
classification_response.inference.result.classification,
ClassificationClassifier,
)
assert (
classification_response.inference.result.classification.document_type
== "invoice"
)