From 55931329eb4dc809b648322173afedd28a75cdb3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:00:27 +0000 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?utf8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- docs_src/custom_response/tutorial009c.py | 1 + tests/test_default_response_class.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs_src/custom_response/tutorial009c.py b/docs_src/custom_response/tutorial009c.py index 337f0cd20..6ac4e2ab7 100644 --- a/docs_src/custom_response/tutorial009c.py +++ b/docs_src/custom_response/tutorial009c.py @@ -10,6 +10,7 @@ class CustomORJSONResponse(Response): def render(self, content: Any) -> bytes: import orjson + assert orjson is not None, "orjson must be installed" return orjson.dumps(content, option=orjson.OPT_INDENT_2) diff --git a/tests/test_default_response_class.py b/tests/test_default_response_class.py index bd37e13e0..821a71373 100644 --- a/tests/test_default_response_class.py +++ b/tests/test_default_response_class.py @@ -1,7 +1,6 @@ from typing import Any import pytest - from fastapi import APIRouter, FastAPI from fastapi.responses import HTMLResponse, JSONResponse, PlainTextResponse from fastapi.testclient import TestClient @@ -12,6 +11,7 @@ class ORJSONResponse(JSONResponse): def render(self, content: Any) -> bytes: import orjson + return orjson.dumps(content) -- 2.47.3