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