From bd0ea6c8abc2b9869a31348c5ee70efb4eaef928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Mon, 9 Feb 2026 18:04:49 +0100 Subject: [PATCH] :recycle: update v2 routes --- .github/workflows/_test-integrations.yml | 2 +- .../{v2_default.txt => v2_extraction.txt} | 7 ++++++- mindee/parsing/v2/inference_response.py | 2 +- .../classification_parameters.py | 2 +- .../classification/classification_response.py | 2 +- mindee/v2/product/crop/crop_parameters.py | 2 +- mindee/v2/product/crop/crop_response.py | 2 +- mindee/v2/product/ocr/ocr_parameters.py | 2 +- mindee/v2/product/ocr/ocr_response.py | 2 +- mindee/v2/product/split/split_parameters.py | 2 +- mindee/v2/product/split/split_response.py | 2 +- tests/data | 2 +- tests/test_code_samples.sh | 2 +- tests/v2/input/test_inference_parameters.py | 4 ++-- tests/v2/input/test_local_response.py | 6 +++--- .../test_classification_integration.py | 4 ++-- .../test_classification_response.py | 4 ++-- tests/v2/product/crop/test_crop_integration.py | 4 ++-- tests/v2/product/crop/test_crop_response.py | 8 +++----- tests/v2/product/extraction/__init__.py | 0 .../extraction/test_extraction_response.py} | 14 ++++++++------ tests/v2/product/ocr/test_ocr_integration.py | 4 ++-- tests/v2/product/ocr/test_ocr_response.py | 6 +++--- .../v2/product/split/test_split_integration.py | 4 ++-- tests/v2/product/split/test_split_response.py | 8 +++----- tests/v2/test_client.py | 18 +++++++++++++----- tests/v2/test_client_integration.py | 10 ++++++---- 27 files changed, 69 insertions(+), 56 deletions(-) rename docs/extras/code_samples/{v2_default.txt => v2_extraction.txt} (91%) create mode 100644 tests/v2/product/extraction/__init__.py rename tests/v2/{parsing/test_inference_response.py => product/extraction/test_extraction_response.py} (96%) diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index eac22534..c5688081 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -47,7 +47,7 @@ jobs: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }} MINDEE_V2_API_KEY: ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} - MINDEE_V2_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} + MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} MINDEE_V2_SE_TESTS_BLANK_PDF_URL: ${{ secrets.MINDEE_V2_SE_TESTS_BLANK_PDF_URL }} MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }} MINDEE_V2_SE_TESTS_CROP_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }} diff --git a/docs/extras/code_samples/v2_default.txt b/docs/extras/code_samples/v2_extraction.txt similarity index 91% rename from docs/extras/code_samples/v2_default.txt rename to docs/extras/code_samples/v2_extraction.txt index 7f4f0be2..9586b210 100644 --- a/docs/extras/code_samples/v2_default.txt +++ b/docs/extras/code_samples/v2_extraction.txt @@ -1,4 +1,9 @@ -from mindee import ClientV2, InferenceParameters, InferenceResponse, PathInput +from mindee import ( + ClientV2, + InferenceParameters, + InferenceResponse, + PathInput, +) input_path = "/path/to/the/file.ext" api_key = "MY_API_KEY" diff --git a/mindee/parsing/v2/inference_response.py b/mindee/parsing/v2/inference_response.py index ff056d36..32becbdf 100644 --- a/mindee/parsing/v2/inference_response.py +++ b/mindee/parsing/v2/inference_response.py @@ -10,7 +10,7 @@ class InferenceResponse(BaseResponse): inference: Inference """Inference result.""" - _slug: str = "inferences" + _slug: str = "products/extraction/results" """Slug of the inference.""" def __init__(self, raw_response: StringDict) -> None: diff --git a/mindee/v2/product/classification/classification_parameters.py b/mindee/v2/product/classification/classification_parameters.py index 590d1f2e..e09cf319 100644 --- a/mindee/v2/product/classification/classification_parameters.py +++ b/mindee/v2/product/classification/classification_parameters.py @@ -6,4 +6,4 @@ class ClassificationParameters(BaseParameters): Parameters accepted by the classification utility v2 endpoint. """ - _slug: str = "utilities/classification" + _slug: str = "products/classification" diff --git a/mindee/v2/product/classification/classification_response.py b/mindee/v2/product/classification/classification_response.py index 01abb3a0..bc2a6d35 100644 --- a/mindee/v2/product/classification/classification_response.py +++ b/mindee/v2/product/classification/classification_response.py @@ -11,7 +11,7 @@ class ClassificationResponse(BaseResponse): inference: ClassificationInference """Inference object for classification inference.""" - _slug: str = "utilities/classification" + _slug: str = "products/classification/results" """Slug of the inference.""" def __init__(self, raw_response: StringDict) -> None: diff --git a/mindee/v2/product/crop/crop_parameters.py b/mindee/v2/product/crop/crop_parameters.py index ad2919aa..070b2ded 100644 --- a/mindee/v2/product/crop/crop_parameters.py +++ b/mindee/v2/product/crop/crop_parameters.py @@ -6,4 +6,4 @@ class CropParameters(BaseParameters): Parameters accepted by the crop utility v2 endpoint. """ - _slug: str = "utilities/crop" + _slug: str = "products/crop" diff --git a/mindee/v2/product/crop/crop_response.py b/mindee/v2/product/crop/crop_response.py index 828baa9e..03b4be0e 100644 --- a/mindee/v2/product/crop/crop_response.py +++ b/mindee/v2/product/crop/crop_response.py @@ -9,7 +9,7 @@ class CropResponse(BaseResponse): inference: CropInference """Inference object for crop inference.""" - _slug: str = "utilities/crop" + _slug: str = "products/crop/results" """Slug of the inference.""" def __init__(self, raw_response: StringDict) -> None: diff --git a/mindee/v2/product/ocr/ocr_parameters.py b/mindee/v2/product/ocr/ocr_parameters.py index 7ed8c263..2e8ecb06 100644 --- a/mindee/v2/product/ocr/ocr_parameters.py +++ b/mindee/v2/product/ocr/ocr_parameters.py @@ -6,4 +6,4 @@ class OCRParameters(BaseParameters): Parameters accepted by the ocr utility v2 endpoint. """ - _slug: str = "utilities/ocr" + _slug: str = "products/ocr" diff --git a/mindee/v2/product/ocr/ocr_response.py b/mindee/v2/product/ocr/ocr_response.py index 318d507a..f7605b02 100644 --- a/mindee/v2/product/ocr/ocr_response.py +++ b/mindee/v2/product/ocr/ocr_response.py @@ -9,7 +9,7 @@ class OCRResponse(BaseResponse): inference: OCRInference """Inference object for ocr inference.""" - _slug: str = "utilities/ocr" + _slug: str = "products/ocr/results" """Slug of the inference.""" def __init__(self, raw_response: StringDict) -> None: diff --git a/mindee/v2/product/split/split_parameters.py b/mindee/v2/product/split/split_parameters.py index 191070f6..ec377dfe 100644 --- a/mindee/v2/product/split/split_parameters.py +++ b/mindee/v2/product/split/split_parameters.py @@ -6,4 +6,4 @@ class SplitParameters(BaseParameters): Parameters accepted by the split utility v2 endpoint. """ - _slug: str = "utilities/split" + _slug: str = "products/split" diff --git a/mindee/v2/product/split/split_response.py b/mindee/v2/product/split/split_response.py index dfb3c6d5..ec5112ef 100644 --- a/mindee/v2/product/split/split_response.py +++ b/mindee/v2/product/split/split_response.py @@ -9,7 +9,7 @@ class SplitResponse(BaseResponse): inference: SplitInference """Inference object for split inference.""" - _slug: str = "utilities/split" + _slug: str = "products/split/results" """Slug of the inference.""" def __init__(self, raw_response: StringDict) -> None: diff --git a/tests/data b/tests/data index 67ccc1d9..37f2e3de 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 67ccc1d9cf8b6263860f79eafbaa2e8b8dd7ac3f +Subproject commit 37f2e3de48918e3b1a0e4604a9292aaeae05c637 diff --git a/tests/test_code_samples.sh b/tests/test_code_samples.sh index e651fec3..c07bdd43 100755 --- a/tests/test_code_samples.sh +++ b/tests/test_code_samples.sh @@ -32,7 +32,7 @@ do sed -i 's/\/path\/to\/the\/file.ext/.\/tests\/data\/file_types\/pdf\/blank_1.pdf/' $OUTPUT_FILE - if echo "${f}" | grep -q "v2_default.txt" + if echo "${f}" | grep -q "v2_extraction.txt" then sed -i "s/MY_API_KEY/$API_KEY_V2/" $OUTPUT_FILE sed -i "s/MY_MODEL_ID/$MODEL_ID/" $OUTPUT_FILE diff --git a/tests/v2/input/test_inference_parameters.py b/tests/v2/input/test_inference_parameters.py index 4def853e..3f527afa 100644 --- a/tests/v2/input/test_inference_parameters.py +++ b/tests/v2/input/test_inference_parameters.py @@ -8,10 +8,10 @@ DataSchemaReplace, DataSchemaField, ) -from tests.utils import V2_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR expected_data_schema_dict = json.loads( - (V2_DATA_DIR / "inference" / "data_schema_replace_param.json").read_text() + (V2_PRODUCT_DATA_DIR / "extraction" / "data_schema_replace_param.json").read_text() ) expected_data_schema_str = json.dumps( expected_data_schema_dict, indent=None, sort_keys=True diff --git a/tests/v2/input/test_local_response.py b/tests/v2/input/test_local_response.py index 5db8be78..eaffa455 100644 --- a/tests/v2/input/test_local_response.py +++ b/tests/v2/input/test_local_response.py @@ -4,17 +4,17 @@ from mindee import InferenceResponse from mindee.input import LocalResponse -from tests.utils import V2_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.fixture def file_path() -> Path: - return V2_DATA_DIR / "inference" / "standard_field_types.json" + return V2_PRODUCT_DATA_DIR / "extraction" / "standard_field_types.json" def _assert_local_response(local_response): fake_hmac_signing = "ogNjY44MhvKPGTtVsI8zG82JqWQa68woYQH" - signature = "f390d9f7f57ac04f47b6309d8a40236b0182610804fc20e91b1f6028aaca07a7" + signature = "e51bdf80f1a08ed44ee161100fc30a25cb35b4ede671b0a575dc9064a3f5dbf1" assert local_response._file is not None assert not local_response.is_valid_hmac_signature( diff --git a/tests/v2/product/classification/test_classification_integration.py b/tests/v2/product/classification/test_classification_integration.py index 75229de4..0889f34b 100644 --- a/tests/v2/product/classification/test_classification_integration.py +++ b/tests/v2/product/classification/test_classification_integration.py @@ -4,7 +4,7 @@ from mindee import ClientV2, PathInput from mindee.v2 import ClassificationParameters, ClassificationResponse -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.fixture(scope="session") @@ -24,7 +24,7 @@ def test_classification_default_sample( v2_client: ClientV2, classification_model_id: str ): input_source = PathInput( - V2_UTILITIES_DATA_DIR / "classification" / "default_invoice.jpg" + V2_PRODUCT_DATA_DIR / "classification" / "default_invoice.jpg" ) response = v2_client.enqueue_and_get_result( ClassificationResponse, diff --git a/tests/v2/product/classification/test_classification_response.py b/tests/v2/product/classification/test_classification_response.py index 6cfb5426..13fee268 100644 --- a/tests/v2/product/classification/test_classification_response.py +++ b/tests/v2/product/classification/test_classification_response.py @@ -9,13 +9,13 @@ ClassificationResponse, ) from mindee.v2.product.classification.classification_result import ClassificationResult -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.mark.v2 def test_classification_single(): input_inference = LocalResponse( - V2_UTILITIES_DATA_DIR / "classification" / "classification_single.json" + V2_PRODUCT_DATA_DIR / "classification" / "classification_single.json" ) classification_response = input_inference.deserialize_response( ClassificationResponse diff --git a/tests/v2/product/crop/test_crop_integration.py b/tests/v2/product/crop/test_crop_integration.py index b96a2230..1b0032c5 100644 --- a/tests/v2/product/crop/test_crop_integration.py +++ b/tests/v2/product/crop/test_crop_integration.py @@ -4,7 +4,7 @@ from mindee import ClientV2, PathInput from mindee.v2 import CropParameters, CropResponse -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.fixture(scope="session") @@ -21,7 +21,7 @@ def v2_client() -> ClientV2: @pytest.mark.integration @pytest.mark.v2 def test_crop_default_sample(v2_client: ClientV2, crop_model_id: str): - input_source = PathInput(V2_UTILITIES_DATA_DIR / "crop" / "default_sample.jpg") + 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) ) diff --git a/tests/v2/product/crop/test_crop_response.py b/tests/v2/product/crop/test_crop_response.py index 0f74e2e2..52565e0b 100644 --- a/tests/v2/product/crop/test_crop_response.py +++ b/tests/v2/product/crop/test_crop_response.py @@ -5,12 +5,12 @@ from mindee.v2.product.crop import CropInference from mindee.v2.product.crop.crop_response import CropResponse from mindee.v2.product.crop.crop_result import CropResult -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.mark.v2 def test_crop_single(): - input_inference = LocalResponse(V2_UTILITIES_DATA_DIR / "crop" / "crop_single.json") + input_inference = LocalResponse(V2_PRODUCT_DATA_DIR / "crop" / "crop_single.json") crop_response = input_inference.deserialize_response(CropResponse) assert isinstance(crop_response.inference, CropInference) assert crop_response.inference.result.crops @@ -29,9 +29,7 @@ def test_crop_single(): @pytest.mark.v2 def test_crop_multiple(): - input_inference = LocalResponse( - V2_UTILITIES_DATA_DIR / "crop" / "crop_multiple.json" - ) + input_inference = LocalResponse(V2_PRODUCT_DATA_DIR / "crop" / "crop_multiple.json") crop_response = input_inference.deserialize_response(CropResponse) assert isinstance(crop_response.inference, CropInference) assert isinstance(crop_response.inference.result, CropResult) diff --git a/tests/v2/product/extraction/__init__.py b/tests/v2/product/extraction/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/v2/parsing/test_inference_response.py b/tests/v2/product/extraction/test_extraction_response.py similarity index 96% rename from tests/v2/parsing/test_inference_response.py rename to tests/v2/product/extraction/test_extraction_response.py index 188ede49..e35091f9 100644 --- a/tests/v2/parsing/test_inference_response.py +++ b/tests/v2/product/extraction/test_extraction_response.py @@ -12,7 +12,7 @@ from mindee.parsing.v2.inference_file import InferenceFile from mindee.parsing.v2.inference_model import InferenceModel from mindee.parsing.v2.rag_metadata import RagMetadata -from tests.utils import V2_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR def _get_samples(json_path: Path, rst_path: Path) -> Tuple[dict, str]: @@ -27,14 +27,14 @@ def _get_samples(json_path: Path, rst_path: Path) -> Tuple[dict, str]: def _get_inference_samples(name: str) -> Tuple[dict, str]: - json_path = V2_DATA_DIR / "inference" / f"{name}.json" - rst_path = V2_DATA_DIR / "inference" / f"{name}.rst" + json_path = V2_PRODUCT_DATA_DIR / "extraction" / f"{name}.json" + rst_path = V2_PRODUCT_DATA_DIR / "extraction" / f"{name}.rst" return _get_samples(json_path, rst_path) def _get_product_samples(product, name: str) -> Tuple[dict, str]: - json_path = V2_DATA_DIR / "products" / product / f"{name}.json" - rst_path = V2_DATA_DIR / "products" / product / f"{name}.rst" + json_path = V2_PRODUCT_DATA_DIR / "extraction" / product / f"{name}.json" + rst_path = V2_PRODUCT_DATA_DIR / "extraction" / product / f"{name}.rst" return _get_samples(json_path, rst_path) @@ -299,7 +299,9 @@ def test_text_context_field_is_false() -> None: @pytest.mark.v2 def test_text_context_field_is_true() -> None: - with open(V2_DATA_DIR / "inference" / "text_context_enabled.json", "r") as file: + with open( + V2_PRODUCT_DATA_DIR / "extraction" / "text_context_enabled.json", "r" + ) as file: json_sample = json.load(file) response = InferenceResponse(json_sample) assert isinstance(response.inference.active_options, InferenceActiveOptions) diff --git a/tests/v2/product/ocr/test_ocr_integration.py b/tests/v2/product/ocr/test_ocr_integration.py index 30f7eb86..abd3362c 100644 --- a/tests/v2/product/ocr/test_ocr_integration.py +++ b/tests/v2/product/ocr/test_ocr_integration.py @@ -5,7 +5,7 @@ from mindee import ClientV2, PathInput from mindee.v2 import OCRParameters, OCRResponse from mindee.v2.product.ocr import OCRInference, OCRResult -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.fixture(scope="session") @@ -22,7 +22,7 @@ def v2_client() -> ClientV2: @pytest.mark.integration @pytest.mark.v2 def test_ocr_default_sample(v2_client: ClientV2, ocr_model_id: str): - input_source = PathInput(V2_UTILITIES_DATA_DIR / "ocr" / "default_sample.jpg") + input_source = PathInput(V2_PRODUCT_DATA_DIR / "ocr" / "default_sample.jpg") response = v2_client.enqueue_and_get_result( OCRResponse, input_source, OCRParameters(ocr_model_id) ) diff --git a/tests/v2/product/ocr/test_ocr_response.py b/tests/v2/product/ocr/test_ocr_response.py index 41cb0d61..ce8ff234 100644 --- a/tests/v2/product/ocr/test_ocr_response.py +++ b/tests/v2/product/ocr/test_ocr_response.py @@ -5,12 +5,12 @@ from mindee.v2.product.ocr import OCRInference from mindee.v2.product.ocr.ocr_response import OCRResponse from mindee.v2.product.ocr.ocr_result import OCRResult -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.mark.v2 def test_ocr_single(): - input_inference = LocalResponse(V2_UTILITIES_DATA_DIR / "ocr" / "ocr_single.json") + input_inference = LocalResponse(V2_PRODUCT_DATA_DIR / "ocr" / "ocr_single.json") ocr_response = input_inference.deserialize_response(OCRResponse) assert isinstance(ocr_response.inference, OCRInference) assert ocr_response.inference.result.pages @@ -83,7 +83,7 @@ def test_ocr_single(): @pytest.mark.v2 def test_ocr_multiple(): - input_inference = LocalResponse(V2_UTILITIES_DATA_DIR / "ocr" / "ocr_multiple.json") + input_inference = LocalResponse(V2_PRODUCT_DATA_DIR / "ocr" / "ocr_multiple.json") ocr_response = input_inference.deserialize_response(OCRResponse) assert isinstance(ocr_response.inference, OCRInference) assert isinstance(ocr_response.inference.result, OCRResult) diff --git a/tests/v2/product/split/test_split_integration.py b/tests/v2/product/split/test_split_integration.py index c37561a1..b0e1c83f 100644 --- a/tests/v2/product/split/test_split_integration.py +++ b/tests/v2/product/split/test_split_integration.py @@ -4,7 +4,7 @@ from mindee import ClientV2, PathInput from mindee.v2 import SplitParameters, SplitResponse -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.fixture(scope="session") @@ -21,7 +21,7 @@ def v2_client() -> ClientV2: @pytest.mark.integration @pytest.mark.v2 def test_split_default_sample(v2_client: ClientV2, split_model_id: str): - input_source = PathInput(V2_UTILITIES_DATA_DIR / "split" / "default_sample.pdf") + input_source = PathInput(V2_PRODUCT_DATA_DIR / "split" / "default_sample.pdf") response = v2_client.enqueue_and_get_result( SplitResponse, input_source, SplitParameters(split_model_id) ) diff --git a/tests/v2/product/split/test_split_response.py b/tests/v2/product/split/test_split_response.py index b04428db..38537a8c 100644 --- a/tests/v2/product/split/test_split_response.py +++ b/tests/v2/product/split/test_split_response.py @@ -5,14 +5,12 @@ from mindee.v2.product.split import SplitInference from mindee.v2.product.split.split_response import SplitResponse from mindee.v2.product.split.split_result import SplitResult -from tests.utils import V2_UTILITIES_DATA_DIR +from tests.utils import V2_PRODUCT_DATA_DIR @pytest.mark.v2 def test_split_single(): - input_inference = LocalResponse( - V2_UTILITIES_DATA_DIR / "split" / "split_single.json" - ) + input_inference = LocalResponse(V2_PRODUCT_DATA_DIR / "split" / "split_single.json") split_response = input_inference.deserialize_response(SplitResponse) assert isinstance(split_response.inference, SplitInference) assert split_response.inference.result.splits @@ -25,7 +23,7 @@ def test_split_single(): @pytest.mark.v2 def test_split_multiple(): input_inference = LocalResponse( - V2_UTILITIES_DATA_DIR / "split" / "split_multiple.json" + V2_PRODUCT_DATA_DIR / "split" / "split_multiple.json" ) split_response = input_inference.deserialize_response(SplitResponse) assert isinstance(split_response.inference, SplitInference) diff --git a/tests/v2/test_client.py b/tests/v2/test_client.py index f51f84cc..a4e87685 100644 --- a/tests/v2/test_client.py +++ b/tests/v2/test_client.py @@ -11,7 +11,7 @@ from mindee.parsing.v2.inference import Inference from mindee.parsing.v2.job import Job from mindee.parsing.v2.job_response import JobResponse -from tests.utils import FILE_TYPES_DIR, V2_DATA_DIR, dummy_envvars +from tests.utils import FILE_TYPES_DIR, V2_PRODUCT_DATA_DIR, V2_DATA_DIR, dummy_envvars @pytest.fixture @@ -57,7 +57,10 @@ class _FakeOkGetInferenceResp: def json(self): data_file = ( - V2_DATA_DIR / "products" / "financial_document" / "complete.json" + V2_PRODUCT_DATA_DIR + / "extraction" + / "financial_document" + / "complete.json" ) with data_file.open("r", encoding="utf-8") as fh: return json.load(fh) @@ -141,7 +144,9 @@ def test_enqueue_and_parse_path_with_env_token(custom_base_url_client): text_context="ignore this message", data_schema=json.loads( ( - V2_DATA_DIR / "inference" / "data_schema_replace_param.json" + V2_PRODUCT_DATA_DIR + / "extraction" + / "data_schema_replace_param.json" ).read_text() ), ), @@ -161,7 +166,7 @@ def _assert_findoc_inference(response: InferenceResponse): @pytest.mark.v2 def test_loads_from_prediction(): input_inference = LocalResponse( - V2_DATA_DIR / "products" / "financial_document" / "complete.json" + V2_PRODUCT_DATA_DIR / "extraction" / "financial_document" / "complete.json" ) response = input_inference.deserialize_response(InferenceResponse) _assert_findoc_inference(response) @@ -182,7 +187,10 @@ def test_error_handling(custom_base_url_client): with pytest.raises(MindeeHTTPErrorV2) as e: custom_base_url_client.enqueue( PathInput( - V2_DATA_DIR / "products" / "financial_document" / "default_sample.jpg" + V2_PRODUCT_DATA_DIR + / "extraction" + / "financial_document" + / "default_sample.jpg" ), InferenceParameters("dummy-model"), ) diff --git a/tests/v2/test_client_integration.py b/tests/v2/test_client_integration.py index 79ad65c4..42c7605f 100644 --- a/tests/v2/test_client_integration.py +++ b/tests/v2/test_client_integration.py @@ -7,13 +7,13 @@ from mindee.error.mindee_http_error_v2 import MindeeHTTPErrorV2 from mindee.parsing.v2 import InferenceActiveOptions from mindee.parsing.v2.inference_response import InferenceResponse -from tests.utils import FILE_TYPES_DIR, V2_PRODUCT_DATA_DIR, V2_DATA_DIR +from tests.utils import FILE_TYPES_DIR, V2_PRODUCT_DATA_DIR @pytest.fixture(scope="session") def findoc_model_id() -> str: """Identifier of the Financial Document model, supplied through an env var.""" - return os.getenv("MINDEE_V2_FINDOC_MODEL_ID") + return os.getenv("MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID") @pytest.fixture(scope="session") @@ -123,7 +123,9 @@ def test_parse_file_filled_single_page_must_succeed( """ Upload a filled single-page JPEG and verify that common fields are present. """ - input_path: Path = V2_PRODUCT_DATA_DIR / "financial_document" / "default_sample.jpg" + input_path: Path = ( + V2_PRODUCT_DATA_DIR / "extraction" / "financial_document" / "default_sample.jpg" + ) input_source = PathInput(input_path) params = InferenceParameters( @@ -280,7 +282,7 @@ def test_data_schema_must_succeed( """ input_path: Path = FILE_TYPES_DIR / "pdf" / "blank_1.pdf" data_schema_replace_path = ( - V2_DATA_DIR / "inference" / "data_schema_replace_param.json" + V2_PRODUCT_DATA_DIR / "extraction" / "data_schema_replace_param.json" ) input_source = PathInput(input_path)