tests/test_return_none_stringified_annotations.py
raw| 1 | import http |
| 2 | |
| 3 | from fastapi import FastAPI |
| 4 | from fastapi.testclient import TestClient |
| 5 | |
| 6 | |
| 7 | def test_no_content(): |
| 8 | app = FastAPI() |
| 9 | |
| 10 | @app.get("/no-content", status_code=http.HTTPStatus.NO_CONTENT) |
| 11 | def return_no_content() -> "None": |
| 12 | return |
| 13 | |
| 14 | client = TestClient(app) |
| 15 | response = client.get("/no-content") |
| 16 | assert response.status_code == http.HTTPStatus.NO_CONTENT, response.text |
| 17 | assert not response.content |