Skip to content

Commit 6ccfd6d

Browse files
johnyrahulclaude
andcommitted
fix: reorder integration tests to avoid usage count drift
Move whisper_detail tests after usage-sensitive url_in_post tests to prevent extra extractions from inflating usage counters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1a88c9e commit 6ccfd6d

1 file changed

Lines changed: 45 additions & 45 deletions

File tree

tests/integration/client_v2_test.py

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -121,51 +121,6 @@ def test_highlight(client_v2: LLMWhispererClientV2, data_dir: str, input_file: s
121121
assert line2["page_height"] == pytest.approx(3168, abs=PAGE_HEIGHT_TOLERANCE)
122122

123123

124-
def test_whisper_detail(client_v2: LLMWhispererClientV2, data_dir: str) -> None:
125-
"""Test whisper_detail returns extraction metadata after a whisper operation."""
126-
file_path = os.path.join(data_dir, "credit_card.pdf")
127-
whisper_result = client_v2.whisper(
128-
mode="native_text",
129-
output_mode="text",
130-
file_path=file_path,
131-
wait_for_completion=True,
132-
)
133-
whisper_hash = whisper_result["whisper_hash"]
134-
135-
detail = client_v2.whisper_detail(whisper_hash)
136-
137-
assert isinstance(detail, dict)
138-
assert detail["whisper_hash"] == whisper_hash
139-
expected_keys = [
140-
"completed_at",
141-
"mode",
142-
"processed_pages",
143-
"processing_started_at",
144-
"processing_time_in_seconds",
145-
"requested_pages",
146-
"tag",
147-
"total_pages",
148-
"upload_file_size_in_kb",
149-
"whisper_hash",
150-
]
151-
assert set(expected_keys).issubset(
152-
detail.keys()
153-
), f"whisper_detail is missing expected keys: {set(expected_keys) - set(detail.keys())}"
154-
assert detail["mode"] == "native_text"
155-
assert detail["processed_pages"] > 0
156-
assert detail["total_pages"] > 0
157-
158-
159-
def test_whisper_detail_not_found(client_v2: LLMWhispererClientV2) -> None:
160-
"""Test whisper_detail raises exception for a nonexistent whisper_hash."""
161-
with pytest.raises(LLMWhispererClientException) as exc_info:
162-
client_v2.whisper_detail("nonexistent_hash_12345")
163-
164-
error = exc_info.value.error_message()
165-
assert exc_info.value.status_code == 400
166-
assert "message" in error
167-
168-
169124
@pytest.mark.parametrize(
170125
"output_mode, mode, url, input_file, page_count",
171126
[
@@ -280,6 +235,51 @@ def test_webhook(client_v2: LLMWhispererClientV2, url: str, token: str, webhook_
280235
assert e.error_message()["status_code"] == 404
281236

282237

238+
def test_whisper_detail(client_v2: LLMWhispererClientV2, data_dir: str) -> None:
239+
"""Test whisper_detail returns extraction metadata after a whisper operation."""
240+
file_path = os.path.join(data_dir, "credit_card.pdf")
241+
whisper_result = client_v2.whisper(
242+
mode="native_text",
243+
output_mode="text",
244+
file_path=file_path,
245+
wait_for_completion=True,
246+
)
247+
whisper_hash = whisper_result["whisper_hash"]
248+
249+
detail = client_v2.whisper_detail(whisper_hash)
250+
251+
assert isinstance(detail, dict)
252+
assert detail["whisper_hash"] == whisper_hash
253+
expected_keys = [
254+
"completed_at",
255+
"mode",
256+
"processed_pages",
257+
"processing_started_at",
258+
"processing_time_in_seconds",
259+
"requested_pages",
260+
"tag",
261+
"total_pages",
262+
"upload_file_size_in_kb",
263+
"whisper_hash",
264+
]
265+
assert set(expected_keys).issubset(
266+
detail.keys()
267+
), f"whisper_detail is missing expected keys: {set(expected_keys) - set(detail.keys())}"
268+
assert detail["mode"] == "native_text"
269+
assert detail["processed_pages"] > 0
270+
assert detail["total_pages"] > 0
271+
272+
273+
def test_whisper_detail_not_found(client_v2: LLMWhispererClientV2) -> None:
274+
"""Test whisper_detail raises exception for a nonexistent whisper_hash."""
275+
with pytest.raises(LLMWhispererClientException) as exc_info:
276+
client_v2.whisper_detail("nonexistent_hash_12345")
277+
278+
error = exc_info.value.error_message()
279+
assert exc_info.value.status_code == 400
280+
assert "message" in error
281+
282+
283283
def assert_error_message(whisper_result: dict) -> None:
284284
assert isinstance(whisper_result, dict)
285285
assert whisper_result["status"] == "error"

0 commit comments

Comments
 (0)