Browse Source

🎨 Auto format

pull/15435/head
pre-commit-ci-lite[bot] 3 months ago
committed by GitHub
parent
commit
fa33788a3b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      fastapi/routing.py
  2. 5
      tests/test_sse.py

2
fastapi/routing.py

@ -1801,7 +1801,7 @@ class APIRouter(routing.Router):
and getattr(route, "stream_item_type", None) is not None
):
new_route.stream_item_type = route.stream_item_type
elif isinstance(route, routing.Route):
methods = list(route.methods or [])
self.add_route(

5
tests/test_sse.py

@ -264,6 +264,7 @@ def test_sse_on_router_included_in_app(client: TestClient):
]
assert len(data_lines) == 2
def test_include_router_copies_stream_item_type():
sub_router = APIRouter()
@ -276,12 +277,10 @@ def test_include_router_copies_stream_item_type():
main_app = FastAPI()
main_app.include_router(sub_router)
route = next(r for r in main_app.routes
if r.path == "/stream_item_type")
route = next(r for r in main_app.routes if r.path == "/stream_item_type")
assert getattr(route, "stream_item_type", None) == Item
# Keepalive ping tests

Loading…
Cancel
Save