Coverage for tests / test_orjson_response_class.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from fastapi import FastAPI 1abcd
2from fastapi.responses import ORJSONResponse 1abcd
3from fastapi.testclient import TestClient 1abcd
4from sqlalchemy.sql.elements import quoted_name 1abcd
6app = FastAPI(default_response_class=ORJSONResponse) 1abcd
9@app.get("/orjson_non_str_keys") 1abcd
10def get_orjson_non_str_keys(): 1abcd
11 key = quoted_name(value="msg", quote=False) 1efg
12 return {key: "Hello World", 1: 1} 1efg
15client = TestClient(app) 1abcd
18def test_orjson_non_str_keys(): 1abcd
19 with client: 1efg
20 response = client.get("/orjson_non_str_keys") 1efg
21 assert response.json() == {"msg": "Hello World", "1": 1} 1efg