66from mindee import ClientV2 , InferenceParameters , PathInput , UrlInputSource
77from mindee .error .mindee_http_error_v2 import MindeeHTTPErrorV2
88from mindee .parsing .v2 import InferenceActiveOptions
9- from mindee .input .inference_parameters import DataSchema
109from mindee .parsing .v2 .inference_response import InferenceResponse
11- from tests .utils import FILE_TYPES_DIR , V2_PRODUCT_DATA_DIR
10+ from tests .utils import FILE_TYPES_DIR , V2_PRODUCT_DATA_DIR , V2_DATA_DIR
1211
1312
1413@pytest .fixture (scope = "session" )
@@ -285,6 +284,9 @@ def test_data_schema_must_succeed(
285284 Load a blank PDF from an HTTPS URL and make sure the inference call completes without raising any errors.
286285 """
287286 input_path : Path = FILE_TYPES_DIR / "pdf" / "blank_1.pdf"
287+ data_schema_replace_path = (
288+ V2_DATA_DIR / "inference" / "data_schema_replace_param.json"
289+ )
288290
289291 input_source = PathInput (input_path )
290292 params = InferenceParameters (
@@ -294,24 +296,13 @@ def test_data_schema_must_succeed(
294296 polygon = False ,
295297 confidence = False ,
296298 webhook_ids = [],
297- data_schema = DataSchema (
298- replace = {
299- "fields" : [
300- {
301- "name" : "test" ,
302- "title" : "Test" ,
303- "is_array" : False ,
304- "type" : "string" ,
305- "description" : "A test field" ,
306- }
307- ]
308- }
309- ),
310- alias = "py_integration_data_schema_override" ,
299+ data_schema = data_schema_replace_path .read_text (),
300+ alias = "py_integration_data_schema_replace" ,
311301 )
312302 response : InferenceResponse = v2_client .enqueue_and_get_inference (
313303 input_source , params
314304 )
315305 _basic_assert_success (response = response , page_count = 1 , model_id = findoc_model_id )
316306 assert response .inference .active_options .data_schema .replace is True
317- assert response .inference .result .fields ["test" ] is not None
307+ assert response .inference .result .fields ["test_replace" ] is not None
308+ assert response .inference .result .fields ["test_replace" ].value == "a test value"
0 commit comments