|
9 | 9 | # pylint: disable=protected-access |
10 | 10 | # pylint: disable=unused-argument |
11 | 11 |
|
12 | | -from typing import Any |
| 12 | +from typing import Any, cast |
13 | 13 |
|
14 | 14 | import pytest |
15 | 15 | from fastapi import HTTPException, status |
@@ -139,6 +139,7 @@ async def test_rlsapi_v1_infer_minimal_request( |
139 | 139 |
|
140 | 140 | assert isinstance(response, RlsapiV1InferResponse) |
141 | 141 | assert response.data.text == "Use the `ls` command to list files in a directory." |
| 142 | + assert response.data.request_id is not None |
142 | 143 | assert check_suid(response.data.request_id) |
143 | 144 |
|
144 | 145 |
|
@@ -221,7 +222,9 @@ async def test_rlsapi_v1_infer_generates_unique_request_ids( |
221 | 222 | request_ids = {r.data.request_id for r in responses} |
222 | 223 |
|
223 | 224 | assert len(request_ids) == 3 |
224 | | - assert all(check_suid(rid) for rid in request_ids) |
| 225 | + for rid in request_ids: |
| 226 | + assert rid is not None |
| 227 | + assert all(check_suid(rid) for rid in request_ids if rid is not None) |
225 | 228 |
|
226 | 229 |
|
227 | 230 | # ========================================== |
@@ -262,7 +265,9 @@ async def test_rlsapi_v1_infer_connection_error_returns_503( |
262 | 265 |
|
263 | 266 | assert exc_info.value.status_code == status.HTTP_503_SERVICE_UNAVAILABLE |
264 | 267 | assert isinstance(exc_info.value.detail, dict) |
265 | | - assert "Llama Stack" in exc_info.value.detail["response"] |
| 268 | + assert "response" in exc_info.value.detail |
| 269 | + detail = cast(dict[str, str], exc_info.value.detail) |
| 270 | + assert "Llama Stack" in detail["response"] |
266 | 271 |
|
267 | 272 |
|
268 | 273 | @pytest.mark.asyncio |
|
0 commit comments