Drop Python 3.8 support

This commit is contained in:
François Voron
2024-11-03 12:51:32 +00:00
committed by GitHub
parent 7f92a82e07
commit caa17889e1
41 changed files with 231 additions and 251 deletions

View File

@ -1,4 +1,5 @@
from typing import Any, AsyncGenerator, Dict, cast
from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
@ -52,7 +53,7 @@ class TestRegister:
json = {"email": "king.arthur@camelot.bt", "password": "g"}
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_400_BAD_REQUEST
data = cast(Dict[str, Any], response.json())
data = cast(dict[str, Any], response.json())
assert data["detail"] == {
"code": ErrorCode.REGISTER_INVALID_PASSWORD,
"reason": "Password should be at least 3 characters",
@ -65,7 +66,7 @@ class TestRegister:
json = {"email": email, "password": "guinevere"}
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_400_BAD_REQUEST
data = cast(Dict[str, Any], response.json())
data = cast(dict[str, Any], response.json())
assert data["detail"] == ErrorCode.REGISTER_USER_ALREADY_EXISTS
@pytest.mark.parametrize("email", ["lancelot@camelot.bt", "Lancelot@camelot.bt"])
@ -74,7 +75,7 @@ class TestRegister:
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_201_CREATED
data = cast(Dict[str, Any], response.json())
data = cast(dict[str, Any], response.json())
assert "hashed_password" not in data
assert "password" not in data
assert data["id"] is not None
@ -88,7 +89,7 @@ class TestRegister:
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_201_CREATED
data = cast(Dict[str, Any], response.json())
data = cast(dict[str, Any], response.json())
assert data["is_superuser"] is False
async def test_valid_body_is_active(self, test_app_client: httpx.AsyncClient):
@ -100,7 +101,7 @@ class TestRegister:
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_201_CREATED
data = cast(Dict[str, Any], response.json())
data = cast(dict[str, Any], response.json())
assert data["is_active"] is True