@@ -37,24 +37,41 @@ def test_parse_file_empty_multiple_pages_must_succeed(
3737 file & model metadata.
3838 """
3939 input_path : Path = FILE_TYPES_DIR / "pdf" / "multipage_cut-2.pdf"
40- assert input_path .exists (), f"sample file missing: { input_path } "
4140
42- input_doc = PathInput (input_path )
43- options = InferenceParameters (findoc_model_id )
41+ input_source = PathInput (input_path )
42+ params = InferenceParameters (
43+ model_id = findoc_model_id ,
44+ rag = False ,
45+ raw_text = True ,
46+ polygon = False ,
47+ confidence = False ,
48+ webhook_ids = [],
49+ alias = "py_integration_empty_multiple" ,
50+ )
4451
4552 response : InferenceResponse = v2_client .enqueue_and_get_inference (
46- input_doc , options
53+ input_source , params
4754 )
4855
4956 assert response is not None
5057 assert response .inference is not None
5158
5259 assert response .inference .file is not None
5360 assert response .inference .file .name == "multipage_cut-2.pdf"
61+ assert response .inference .file .page_count == 2
5462
5563 assert response .inference .model is not None
5664 assert response .inference .model .id == findoc_model_id
5765
66+ assert response .inference .active_options is not None
67+ assert response .inference .active_options .rag is False
68+ assert response .inference .active_options .raw_text is True
69+ assert response .inference .active_options .polygon is False
70+ assert response .inference .active_options .confidence is False
71+
72+ assert response .inference .result .raw_text is not None
73+ assert len (response .inference .result .raw_text .pages ) == 2
74+
5875
5976@pytest .mark .integration
6077@pytest .mark .v2
@@ -65,28 +82,46 @@ def test_parse_file_filled_single_page_must_succeed(
6582 Upload a filled single-page JPEG and verify that common fields are present.
6683 """
6784 input_path : Path = PRODUCT_DATA_DIR / "financial_document" / "default_sample.jpg"
68- assert input_path .exists (), f"sample file missing: { input_path } "
6985
70- input_doc = PathInput (input_path )
71- options = InferenceParameters (findoc_model_id )
86+ input_source = PathInput (input_path )
87+ params = InferenceParameters (
88+ model_id = findoc_model_id ,
89+ rag = False ,
90+ raw_text = False ,
91+ polygon = False ,
92+ confidence = False ,
93+ webhook_ids = [],
94+ alias = "py_integration_filled_single" ,
95+ )
7296
7397 response : InferenceResponse = v2_client .enqueue_and_get_inference (
74- input_doc , options
98+ input_source , params
7599 )
76100
77101 assert response is not None
78102 assert response .inference is not None
79103
80104 assert response .inference .file is not None
81105 assert response .inference .file .name == "default_sample.jpg"
106+ assert response .inference .file .page_count == 1
82107
83108 assert response .inference .model is not None
84109 assert response .inference .model .id == findoc_model_id
85110
111+ assert response .inference .active_options is not None
112+ assert response .inference .active_options .rag is False
113+ assert response .inference .active_options .raw_text is False
114+ assert response .inference .active_options .polygon is False
115+ assert response .inference .active_options .confidence is False
116+
117+ assert response .inference .result .raw_text is None
118+
86119 assert response .inference .result is not None
87120 supplier_name = response .inference .result .fields ["supplier_name" ]
88121 assert supplier_name is not None
89122 assert supplier_name .value == "John Smith"
123+ assert supplier_name .confidence is None
124+ assert len (supplier_name .locations ) == 0
90125
91126
92127@pytest .mark .integration
@@ -96,13 +131,12 @@ def test_invalid_uuid_must_throw_error_422(v2_client: ClientV2) -> None:
96131 Using an invalid model identifier must trigger a 422 HTTP error.
97132 """
98133 input_path : Path = FILE_TYPES_DIR / "pdf" / "multipage_cut-2.pdf"
99- assert input_path .exists ()
100134
101- input_doc = PathInput (input_path )
102- options = InferenceParameters ("INVALID MODEL ID" )
135+ input_source = PathInput (input_path )
136+ params = InferenceParameters (model_id = "INVALID MODEL ID" )
103137
104138 with pytest .raises (MindeeHTTPErrorV2 ) as exc_info :
105- v2_client .enqueue_inference (input_doc , options )
139+ v2_client .enqueue_inference (input_source , params )
106140
107141 exc : MindeeHTTPErrorV2 = exc_info .value
108142 assert exc .status == 422
@@ -119,10 +153,18 @@ def test_url_input_source_must_not_raise_errors(
119153 """
120154 url = os .getenv ("MINDEE_V2_SE_TESTS_BLANK_PDF_URL" )
121155
122- input_doc = UrlInputSource (url )
123- options = InferenceParameters (findoc_model_id )
156+ input_source = UrlInputSource (url )
157+ params = InferenceParameters (
158+ model_id = findoc_model_id ,
159+ rag = False ,
160+ raw_text = False ,
161+ polygon = False ,
162+ confidence = False ,
163+ webhook_ids = [],
164+ alias = "py_integration_url_source" ,
165+ )
124166 response : InferenceResponse = v2_client .enqueue_and_get_inference (
125- input_doc , options
167+ input_source , params
126168 )
127169 assert response is not None
128170 assert response .inference is not None
0 commit comments