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