From ff409c1ebd6ff9a7c961adce4ef52f770c02ee58 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 27 Nov 2024 11:51:18 -0600 Subject: [PATCH] add missing types for generic --- tests/test_redis_storage.py | 6 +++--- tests/typedefs.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_redis_storage.py b/tests/test_redis_storage.py index 9a2f133b..36696192 100644 --- a/tests/test_redis_storage.py +++ b/tests/test_redis_storage.py @@ -34,7 +34,7 @@ def create_app( async def make_cookie( - client: TestClient, redis: aioredis.Redis, data: dict[Any, Any] + client: TestClient[web.Request, web.Application], redis: aioredis.Redis, data: dict[Any, Any] ) -> None: session_data = {"session": data, "created": int(time.time())} value = json.dumps(session_data) @@ -43,13 +43,13 @@ async def make_cookie( client.session.cookie_jar.update_cookies({"AIOHTTP_SESSION": key}) -async def make_cookie_with_bad_value(client: TestClient, redis: aioredis.Redis) -> None: +async def make_cookie_with_bad_value(client: TestClient[web.Request, web.Application], redis: aioredis.Redis) -> None: key = uuid.uuid4().hex await redis.set("AIOHTTP_SESSION_" + key, "") client.session.cookie_jar.update_cookies({"AIOHTTP_SESSION": key}) -async def load_cookie(client: TestClient, redis: aioredis.Redis) -> Any: +async def load_cookie(client: TestClient[web.Request, web.Application], redis: aioredis.Redis) -> Any: cookies = client.session.cookie_jar.filter_cookies(client.make_url("/")) key = cookies["AIOHTTP_SESSION"] value_bytes = await redis.get("AIOHTTP_SESSION_" + key.value) diff --git a/tests/typedefs.py b/tests/typedefs.py index 6b37ae66..6d4833e8 100644 --- a/tests/typedefs.py +++ b/tests/typedefs.py @@ -3,4 +3,4 @@ from aiohttp import web from aiohttp.test_utils import TestClient -AiohttpClient = Callable[[web.Application], Awaitable[TestClient]] +AiohttpClient = Callable[[web.Application], Awaitable[TestClient[web.Request, web.Application]]]