Coverage for tests/test_openapi_model_description_trim_on_formfeed.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-09-09 09:16 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-09-09 09:16 +0000
1from fastapi import FastAPI 1abcdef
2from fastapi.testclient import TestClient 1abcdef
3from pydantic import BaseModel 1abcdef
5app = FastAPI() 1abcdef
8class MyModel(BaseModel): 1abcdef
9 """
10 A model with a form feed character in the title.
11 \f
12 Text after form feed character.
13 """
16@app.get("/foo") 1abcdef
17def foo(v: MyModel): # pragma: no cover 1abcdef
18 pass
21client = TestClient(app) 1abcdef
24def test_openapi(): 1abcdef
25 response = client.get("/openapi.json") 1ghijkl
26 assert response.status_code == 200, response.text 1ghijkl
27 openapi_schema = response.json() 1ghijkl
29 assert openapi_schema["components"]["schemas"]["MyModel"]["description"] == ( 1ghijkl
30 "A model with a form feed character in the title.\n"
31 )