Skip to content

Commit b690c15

Browse files
Refine error names and tests to be a little more descriptive
1 parent ceb617a commit b690c15

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/test_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ async def test_500_raises_server_error(
299299

300300
async def test_422_raises_api_error(mock_api, authenticated_client: EVEClient):
301301
"""Test that 422 response code raises APIError"""
302-
random_error = 422
302+
unprocessable_entity = 422
303303
mock_api.post("/conversations").mock(
304304
return_value=Response(
305-
random_error,
305+
unprocessable_entity,
306306
json={
307307
"detail": [{"msg": "field required", "type": "missing"}],
308308
},
@@ -312,25 +312,25 @@ async def test_422_raises_api_error(mock_api, authenticated_client: EVEClient):
312312
with pytest.raises(APIError) as exc_info:
313313
await authenticated_client.post("/conversations", json={})
314314

315-
assert exc_info.value.status_code == random_error
315+
assert exc_info.value.status_code == unprocessable_entity
316316

317317

318-
async def test_response_invalid_json_raises_api_error(
318+
async def test_response_missing_detail_raises_api_error(
319319
mock_api, authenticated_client: EVEClient
320320
):
321-
"""Test that invalid JSON in the response raises APIError"""
322-
random_error = 452
321+
"""Test that error response without 'detail' key raises APIError"""
322+
unknown_error = 452
323323
mock_api.post("/conversations").mock(
324324
return_value=Response(
325-
random_error,
325+
unknown_error,
326326
json="Some invalid JSON",
327327
)
328328
)
329329

330330
with pytest.raises(APIError) as exc_info:
331331
await authenticated_client.post("/conversations", json={})
332332

333-
assert exc_info.value.status_code == random_error
333+
assert exc_info.value.status_code == unknown_error
334334

335335

336336
# --- Streaming ---

0 commit comments

Comments
 (0)