Skip to content

Commit 584fb83

Browse files
update test syntax
1 parent c8f10b0 commit 584fb83

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

tests/v2/test_client.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ def test_enqueue_path_with_env_token(custom_base_url_client):
124124
f"{FILE_TYPES_DIR}/receipt.jpg"
125125
)
126126
with pytest.raises(MindeeHTTPErrorV2):
127-
custom_base_url_client.enqueue_inference(
128-
input_doc, InferenceParameters("dummy-model")
129-
)
127+
custom_base_url_client.enqueue(input_doc, InferenceParameters("dummy-model"))
130128

131129

132130
@pytest.mark.v2
@@ -135,7 +133,8 @@ def test_enqueue_and_parse_path_with_env_token(custom_base_url_client):
135133
f"{FILE_TYPES_DIR}/receipt.jpg"
136134
)
137135
with pytest.raises(MindeeHTTPErrorV2):
138-
custom_base_url_client.enqueue_and_get_inference(
136+
custom_base_url_client.enqueue_and_get_result(
137+
InferenceResponse,
139138
input_doc,
140139
InferenceParameters(
141140
"dummy-model",
@@ -172,16 +171,16 @@ def test_loads_from_prediction():
172171

173172
@pytest.mark.v2
174173
def test_get_inference(custom_base_url_client):
175-
response = custom_base_url_client.get_inference(
176-
"12345678-1234-1234-1234-123456789ABC"
174+
response = custom_base_url_client.get_result(
175+
InferenceResponse, "12345678-1234-1234-1234-123456789ABC"
177176
)
178177
_assert_findoc_inference(response)
179178

180179

181180
@pytest.mark.v2
182181
def test_error_handling(custom_base_url_client):
183182
with pytest.raises(MindeeHTTPErrorV2) as e:
184-
custom_base_url_client.enqueue_inference(
183+
custom_base_url_client.enqueue(
185184
PathInput(
186185
V2_DATA_DIR / "products" / "financial_document" / "default_sample.jpg"
187186
),

tests/v2/test_client_integration.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def test_parse_file_empty_multiple_pages_must_succeed(
5858
alias="py_integration_empty_multiple",
5959
)
6060

61-
response: InferenceResponse = v2_client.enqueue_and_get_inference(
62-
input_source, params
61+
response: InferenceResponse = v2_client.enqueue_and_get_result(
62+
InferenceResponse, input_source, params
6363
)
6464
_basic_assert_success(response=response, page_count=2, model_id=findoc_model_id)
6565

@@ -99,8 +99,8 @@ def test_parse_file_empty_single_page_options_must_succeed(
9999
confidence=True,
100100
alias="py_integration_empty_page_options",
101101
)
102-
response: InferenceResponse = v2_client.enqueue_and_get_inference(
103-
input_source, params
102+
response: InferenceResponse = v2_client.enqueue_and_get_result(
103+
InferenceResponse, input_source, params
104104
)
105105
_basic_assert_success(response=response, page_count=1, model_id=findoc_model_id)
106106

@@ -137,8 +137,8 @@ def test_parse_file_filled_single_page_must_succeed(
137137
text_context="this is an invoice.",
138138
)
139139

140-
response: InferenceResponse = v2_client.enqueue_and_get_inference(
141-
input_source, params
140+
response: InferenceResponse = v2_client.enqueue_and_get_result(
141+
InferenceResponse, input_source, params
142142
)
143143
_basic_assert_success(response=response, page_count=1, model_id=findoc_model_id)
144144

@@ -178,7 +178,7 @@ def test_invalid_uuid_must_throw_error(v2_client: ClientV2) -> None:
178178
)
179179

180180
with pytest.raises(MindeeHTTPErrorV2) as exc_info:
181-
v2_client.enqueue_inference(input_source, params)
181+
v2_client.enqueue(input_source, params)
182182

183183
exc: MindeeHTTPErrorV2 = exc_info.value
184184
assert exc.status == 422
@@ -199,7 +199,7 @@ def test_unknown_model_must_throw_error(v2_client: ClientV2) -> None:
199199
params = InferenceParameters(model_id="fc405e37-4ba4-4d03-aeba-533a8d1f0f21")
200200

201201
with pytest.raises(MindeeHTTPErrorV2) as exc_info:
202-
v2_client.enqueue_inference(input_source, params)
202+
v2_client.enqueue(input_source, params)
203203

204204
exc: MindeeHTTPErrorV2 = exc_info.value
205205
assert exc.status == 404
@@ -232,7 +232,7 @@ def test_unknown_webhook_ids_must_throw_error(
232232
)
233233

234234
with pytest.raises(MindeeHTTPErrorV2) as exc_info:
235-
v2_client.enqueue_inference(input_source, params)
235+
v2_client.enqueue(input_source, params)
236236

237237
exc: MindeeHTTPErrorV2 = exc_info.value
238238
assert exc.status == 422
@@ -263,8 +263,8 @@ def test_blank_url_input_source_must_succeed(
263263
webhook_ids=[],
264264
alias="py_integration_url_source",
265265
)
266-
response: InferenceResponse = v2_client.enqueue_and_get_inference(
267-
input_source, params
266+
response: InferenceResponse = v2_client.enqueue_and_get_result(
267+
InferenceResponse, input_source, params
268268
)
269269
_basic_assert_success(response=response, page_count=1, model_id=findoc_model_id)
270270

@@ -294,8 +294,8 @@ def test_data_schema_must_succeed(
294294
data_schema=data_schema_replace_path.read_text(),
295295
alias="py_integration_data_schema_replace",
296296
)
297-
response: InferenceResponse = v2_client.enqueue_and_get_inference(
298-
input_source, params
297+
response: InferenceResponse = v2_client.enqueue_and_get_result(
298+
InferenceResponse, input_source, params
299299
)
300300
_basic_assert_success(response=response, page_count=1, model_id=findoc_model_id)
301301
assert response.inference.active_options.data_schema.replace is True

0 commit comments

Comments
 (0)