Browse Source

🎨 Auto format

pull/14976/head
pre-commit-ci-lite[bot] 5 months ago
committed by GitHub
parent
commit
908e13c1f7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      fastapi/responses.py
  2. 6
      tests/test_sse_response.py

3
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 fastapi.exceptions import FastAPIDeprecationWarning
from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import FileResponse as FileResponse # noqa

6
tests/test_sse_response.py

@ -1,8 +1,8 @@
"""Tests for Server-Sent Events (SSE) response.""" """Tests for Server-Sent Events (SSE) response."""
from collections.abc import AsyncGenerator from collections.abc import AsyncGenerator
from typing import Any from typing import Any
import pytest
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.responses import SSEResponse, sse_content from fastapi.responses import SSEResponse, sse_content
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
@ -143,7 +143,9 @@ def test_sse_content_helper():
from starlette.responses import StreamingResponse 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) client = TestClient(app, raise_server_exceptions=False)
response = client.get("/events") response = client.get("/events")

Loading…
Cancel
Save