fix: py310 unit tests

For some reasons, list["Client"] does not resolve the ForwardRef in
python 3.10 as it does with typing.List["Client"], which in the end
breaks the memory backend model accessors.
This commit is contained in:
Éloi Rivard 2024-10-28 21:41:51 +01:00
parent 0b51b01031
commit 6b5e3e1a8e
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184

View file

@ -1,6 +1,9 @@
import datetime
from typing import ClassVar
# keep 'List' instead of 'list' for audiences to not break py310 with the memory backend
from typing import List # noqa: UP035
from canaille.backends.models import Model
from canaille.core.models import User
@ -18,7 +21,8 @@ class Client(Model):
description: str | None = None
preconsent: bool | None = False
audience: list["Client"] = []
# keep 'List' instead of 'list' do not break py310 with the memory backend
audience: List["Client"] = [] # noqa: UP006
client_id: str | None
"""REQUIRED.
@ -320,7 +324,8 @@ class Token(Model):
issue_date: datetime.datetime
lifetime: int
revokation_date: datetime.datetime
audience: list["Client"]
# keep 'List' instead of 'list' do not break py310 with the memory backend
audience: List["Client"] # noqa: UP006
class Consent(Model):