diff --git a/fastapi/responses.py b/fastapi/responses.py index 5a71d23490..4e4a1cf4b4 100644 --- a/fastapi/responses.py +++ b/fastapi/responses.py @@ -1,4 +1,5 @@ -from typing import Any, AsyncGenerator, Literal +from collections.abc import AsyncGenerator +from typing import Any from fastapi.exceptions import FastAPIDeprecationWarning from starlette.responses import FileResponse as FileResponse # noqa diff --git a/tests/test_sse_response.py b/tests/test_sse_response.py index 08724e9fdc..cee30a4e43 100644 --- a/tests/test_sse_response.py +++ b/tests/test_sse_response.py @@ -1,8 +1,8 @@ """Tests for Server-Sent Events (SSE) response.""" + from collections.abc import AsyncGenerator from typing import Any -import pytest from fastapi import FastAPI from fastapi.responses import SSEResponse, sse_content from fastapi.testclient import TestClient @@ -143,7 +143,9 @@ def test_sse_content_helper(): from starlette.responses import StreamingResponse - return StreamingResponse(sse_content(generator()), media_type="text/event-stream") + return StreamingResponse( + sse_content(generator()), media_type="text/event-stream" + ) client = TestClient(app, raise_server_exceptions=False) response = client.get("/events")