diff --git a/async_asgi_testclient/exceptions.py b/async_asgi_testclient/exceptions.py index a02efe9..5e0636c 100644 --- a/async_asgi_testclient/exceptions.py +++ b/async_asgi_testclient/exceptions.py @@ -4,9 +4,8 @@ (and in some cases, possible at all) to handle errors in different ways. """ -from typing import Optional - from async_asgi_testclient.utils import Message +from typing import Optional class TestClientError(Exception): diff --git a/async_asgi_testclient/testing.py b/async_asgi_testclient/testing.py index 8c75af3..bc18d3b 100644 --- a/async_asgi_testclient/testing.py +++ b/async_asgi_testclient/testing.py @@ -111,7 +111,9 @@ async def send_lifespan(self, action): message = await receive(self._lifespan_output_queue, timeout=self.timeout) if isinstance(message, Message): - raise TestClientError(f"{message.event} - {message.reason} - {message.task}", message=message) + raise TestClientError( + f"{message.event} - {message.reason} - {message.task}", message=message + ) if message["type"] == f"lifespan.{action}.complete": pass @@ -272,7 +274,10 @@ async def open( message = await self.wait_response(receive_or_fail, "http.response.start") response.status_code = message["status"] response.headers = CIMultiDict( - [(k.decode("utf8"), v.decode("utf8")) for k, v in message.get("headers", [])] + [ + (k.decode("utf8"), v.decode("utf8")) + for k, v in message.get("headers", []) + ] ) # Receive initial response body diff --git a/async_asgi_testclient/websocket.py b/async_asgi_testclient/websocket.py index c5fae5f..95e0f7f 100644 --- a/async_asgi_testclient/websocket.py +++ b/async_asgi_testclient/websocket.py @@ -113,7 +113,7 @@ async def connect(self): headers.add("Cookie", cookie_jar.output(header="")) scope = { - "asgi": {"version": "3.0", }, + "asgi": {"version": "3.0",}, "type": "websocket", "headers": flatten_headers(headers), "path": path,