From 3b563725ee5cfc7eca0f2e34da9f12185365f83e Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Wed, 10 Dec 2025 13:58:29 +0100 Subject: [PATCH] Remove code examples for Python 3.8 in `authentication_error_status_code` --- .../tutorial001_an.py | 20 ------------------- .../test_tutorial001.py | 5 +---- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 docs_src/authentication_error_status_code/tutorial001_an.py diff --git a/docs_src/authentication_error_status_code/tutorial001_an.py b/docs_src/authentication_error_status_code/tutorial001_an.py deleted file mode 100644 index 40678e858..000000000 --- a/docs_src/authentication_error_status_code/tutorial001_an.py +++ /dev/null @@ -1,20 +0,0 @@ -from fastapi import Depends, FastAPI, HTTPException, status -from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer -from typing_extensions import Annotated - -app = FastAPI() - - -class HTTPBearer403(HTTPBearer): - def make_not_authenticated_error(self) -> HTTPException: - return HTTPException( - status_code=status.HTTP_403_FORBIDDEN, detail="Not authenticated" - ) - - -CredentialsDep = Annotated[HTTPAuthorizationCredentials, Depends(HTTPBearer403())] - - -@app.get("/me") -def read_me(credentials: CredentialsDep): - return {"message": "You are authenticated", "token": credentials.credentials} diff --git a/tests/test_tutorial/test_authentication_error_status_code/test_tutorial001.py b/tests/test_tutorial/test_authentication_error_status_code/test_tutorial001.py index bbd7bff30..6f5811631 100644 --- a/tests/test_tutorial/test_authentication_error_status_code/test_tutorial001.py +++ b/tests/test_tutorial/test_authentication_error_status_code/test_tutorial001.py @@ -4,14 +4,11 @@ import pytest from fastapi.testclient import TestClient from inline_snapshot import snapshot -from ...utils import needs_py39 - @pytest.fixture( name="client", params=[ - "tutorial001_an", - pytest.param("tutorial001_an_py39", marks=needs_py39), + "tutorial001_an_py39", ], ) def get_client(request: pytest.FixtureRequest):