From 727ed41b9b505c53460d2a7b47aacc6ffdab0419 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 03:08:43 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/routing.py | 6 ++++-- tests/test_router_mount.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 8fdee2c8e1..e42e092f12 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -1550,8 +1550,10 @@ class APIRouter(routing.Router): prefix + route.path, route.endpoint, name=route.name ) elif isinstance(route, routing.Mount): - self.mount(prefix + router.prefix + route.path, route.app, name=route.name) - + self.mount( + prefix + router.prefix + route.path, route.app, name=route.name + ) + for handler in router.on_startup: self.add_event_handler("startup", handler) for handler in router.on_shutdown: diff --git a/tests/test_router_mount.py b/tests/test_router_mount.py index 9bee074f48..57dbdd3e66 100644 --- a/tests/test_router_mount.py +++ b/tests/test_router_mount.py @@ -1,4 +1,4 @@ -from fastapi import FastAPI, APIRouter +from fastapi import APIRouter, FastAPI from fastapi.testclient import TestClient @@ -22,4 +22,4 @@ def test_mount_on_router(): client = TestClient(app) assert client.get("/api/app").status_code == 200 - assert client.get("/api/subapi/sub").status_code == 200 \ No newline at end of file + assert client.get("/api/subapi/sub").status_code == 200