diff --git a/tests/test_return_none_future_annotations.py b/tests/test_return_none_future_annotations.py deleted file mode 100644 index 44dee5591..000000000 --- a/tests/test_return_none_future_annotations.py +++ /dev/null @@ -1,27 +0,0 @@ -from __future__ import annotations - -import http -import logging - -from fastapi import APIRouter, FastAPI -from fastapi.testclient import TestClient - -router = APIRouter() - -app = FastAPI() - - -@router.get("/no-content", status_code=http.HTTPStatus.NO_CONTENT) -def return_no_content() -> None: - logging.info("endpoint called") - - -app.include_router(router) - -client = TestClient(app) - - -def test_no_content(): - response = client.get("/no-content") - assert response.status_code == http.HTTPStatus.NO_CONTENT, response.text - assert not response.content diff --git a/tests/test_return_none_stringified_annotations.py b/tests/test_return_none_stringified_annotations.py new file mode 100644 index 000000000..06f151fe3 --- /dev/null +++ b/tests/test_return_none_stringified_annotations.py @@ -0,0 +1,16 @@ +import http + +from fastapi import FastAPI +from fastapi.testclient import TestClient + + +def test_no_content(): + app = FastAPI() + + @app.get("/no-content", status_code=http.HTTPStatus.NO_CONTENT) + def return_no_content() -> "None": ... # pragma: no cover + + client = TestClient(app) + response = client.get("/no-content") + assert response.status_code == http.HTTPStatus.NO_CONTENT, response.text + assert not response.content