From 4f46804e9d7ea8f9883505109e9335a4b5462eb4 Mon Sep 17 00:00:00 2001 From: Raphael Krupinski Date: Fri, 3 Jan 2025 16:16:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Upgrade=20list=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_client.py | 2 +- tests/test_request.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 0049fce..b5211be 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -57,7 +57,7 @@ async def cat_list(request: Request) -> JSONResponse: return_list = request.headers.get('return-list', 'false') == 'True' token = request.headers.get('token') - serializer = pydantic.TypeAdapter(typing.List[Cat]) + serializer = pydantic.TypeAdapter(list[Cat]) data = [Cat(id=1, name='Tom')] headers = { 'X-Count': str(len(data)), diff --git a/tests/test_request.py b/tests/test_request.py index fd0d39d..f050bb9 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -18,7 +18,7 @@ class MyRequestBodyModel(pydantic.BaseModel): class MyRequestBodyList(pydantic.RootModel): - root: typing.List[MyRequestBodyModel] + root: list[MyRequestBodyModel] @pytest_asyncio.fixture(scope='function') @@ -66,7 +66,7 @@ class Client(ClientTestBase): @get('/param_list_simple') async def param_list_simple( self: typing.Self, - q_a: typing.Annotated[typing.List[str], Query('a', style=SimpleMultimap)], + q_a: typing.Annotated[list[str], Query('a', style=SimpleMultimap)], ) -> typing.Annotated[Awaitable[None], Responses({})]: pass @@ -113,7 +113,7 @@ class Client(ClientTestBase): @get('/param_list_exploded') async def param_list_exploded( self: typing.Self, - q_a: typing.Annotated[typing.List[str], Query('a', style=SimpleMultimap)], + q_a: typing.Annotated[list[str], Query('a', style=SimpleMultimap)], ) -> typing.Annotated[Awaitable[None], Responses({})]: pass @@ -137,7 +137,7 @@ class Client(ClientTestBase): @get('/param_list_exploded') async def op( self: typing.Self, - q_a: typing.Annotated[typing.List[str], Query], + q_a: typing.Annotated[list[str], Query], ) -> typing.Annotated[Awaitable[None], Responses({})]: pass