From a0b52a372e09ece6f94f1850757dd233c1d5d0b4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 17:14:56 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_connector.py | 16 +++++++++++----- tests/test_proxy.py | 13 ++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tests/test_connector.py b/tests/test_connector.py index bb38605cdd3..fadd8a9bebd 100644 --- a/tests/test_connector.py +++ b/tests/test_connector.py @@ -561,12 +561,14 @@ async def test_tcp_connector_server_hostname_default(loop) -> None: conn = aiohttp.TCPConnector(loop=loop) conn._loop.create_connection = mock.AsyncMock() - conn._loop.create_connection.return_value = mock.Mock(), mock.Mock() + conn._loop.create_connection.return_value = mock.Mock(), mock.Mock() req = ClientRequest("GET", URL("https://127.0.0.1:443"), loop=loop) established_connection = await conn.connect(req, [], ClientTimeout()) - assert conn._loop.create_connection.call_args.kwargs["server_hostname"] == "127.0.0.1" + assert ( + conn._loop.create_connection.call_args.kwargs["server_hostname"] == "127.0.0.1" + ) established_connection.close() @@ -575,12 +577,16 @@ async def test_tcp_connector_server_hostname_override(loop) -> None: conn = aiohttp.TCPConnector(loop=loop) conn._loop.create_connection = mock.AsyncMock() - conn._loop.create_connection.return_value = mock.Mock(), mock.Mock() + conn._loop.create_connection.return_value = mock.Mock(), mock.Mock() - req = ClientRequest("GET", URL("https://127.0.0.1:443"), loop=loop, server_hostname="localhost") + req = ClientRequest( + "GET", URL("https://127.0.0.1:443"), loop=loop, server_hostname="localhost" + ) established_connection = await conn.connect(req, [], ClientTimeout()) - assert conn._loop.create_connection.call_args.kwargs["server_hostname"] == "localhost" + assert ( + conn._loop.create_connection.call_args.kwargs["server_hostname"] == "localhost" + ) established_connection.close() diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 66b1385918f..4e861d48329 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -238,7 +238,9 @@ async def make_conn(): connector._create_connection(req, None, aiohttp.ClientTimeout()) ) - self.assertEqual(self.loop.start_tls.call_args.kwargs["server_hostname"], "www.python.org") + self.assertEqual( + self.loop.start_tls.call_args.kwargs["server_hostname"], "www.python.org" + ) self.loop.run_until_complete(proxy_req.close()) proxy_resp.close() @@ -247,7 +249,9 @@ async def make_conn(): @mock.patch("aiohttp.connector.ClientRequest") def test_proxy_server_hostname_override(self, ClientRequestMock) -> None: proxy_req = ClientRequest( - "GET", URL("http://proxy.example.com"), loop=self.loop, + "GET", + URL("http://proxy.example.com"), + loop=self.loop, ) ClientRequestMock.return_value = proxy_req @@ -297,7 +301,10 @@ async def make_conn(): connector._create_connection(req, None, aiohttp.ClientTimeout()) ) - self.assertEqual(self.loop.start_tls.call_args.kwargs["server_hostname"], "server-hostname.example.com") + self.assertEqual( + self.loop.start_tls.call_args.kwargs["server_hostname"], + "server-hostname.example.com", + ) self.loop.run_until_complete(proxy_req.close()) proxy_resp.close()