Skip to content

Commit 9d51db2

Browse files
authored
Merge pull request #1122 from tisnik/lcore-886-fixed-pyright-issues-in-endpoints
LCORE-886: fixed Pyright issues in endpoints
2 parents dca93b5 + 4f69068 commit 9d51db2

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

tests/integration/endpoints/test_config_integration.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Integration tests for the /config endpoint."""
22

3+
from typing import cast
34
import pytest
5+
46
from fastapi import HTTPException, Request, status
57

68
from app.endpoints.config import config_endpoint_handler
@@ -81,6 +83,6 @@ async def test_config_endpoint_fails_without_configuration(
8183
# Verify error details
8284
assert exc_info.value.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
8385
assert isinstance(exc_info.value.detail, dict)
84-
assert (
85-
"configuration is not loaded" in exc_info.value.detail["response"].lower()
86-
) # type: ignore
86+
assert "response" in exc_info.value.detail
87+
detail = cast(dict[str, str], exc_info.value.detail)
88+
assert "configuration is not loaded" in detail["response"].lower()

tests/integration/endpoints/test_rlsapi_v1_integration.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# pylint: disable=protected-access
1010
# pylint: disable=unused-argument
1111

12-
from typing import Any
12+
from typing import Any, cast
1313

1414
import pytest
1515
from fastapi import HTTPException, status
@@ -139,6 +139,7 @@ async def test_rlsapi_v1_infer_minimal_request(
139139

140140
assert isinstance(response, RlsapiV1InferResponse)
141141
assert response.data.text == "Use the `ls` command to list files in a directory."
142+
assert response.data.request_id is not None
142143
assert check_suid(response.data.request_id)
143144

144145

@@ -221,7 +222,9 @@ async def test_rlsapi_v1_infer_generates_unique_request_ids(
221222
request_ids = {r.data.request_id for r in responses}
222223

223224
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)
225228

226229

227230
# ==========================================
@@ -262,7 +265,9 @@ async def test_rlsapi_v1_infer_connection_error_returns_503(
262265

263266
assert exc_info.value.status_code == status.HTTP_503_SERVICE_UNAVAILABLE
264267
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"]
266271

267272

268273
@pytest.mark.asyncio

0 commit comments

Comments
 (0)