diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index 0f747725d..4765a3cf2 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -228,7 +228,9 @@ async def close(self, timeout: float = 2.0): self._channel_refresh_task = None async def _ping_and_warm_instances( - self, instance_key: _WarmedInstanceKey | None = None, channel: grpc.aio.Channel|None=None + self, + instance_key: _WarmedInstanceKey | None = None, + channel: grpc.aio.Channel | None = None, ) -> list[BaseException | None]: """ Prepares the backend for requests on a channel diff --git a/tests/unit/data/_async/test_client.py b/tests/unit/data/_async/test_client.py index 14dffe66c..be34d344a 100644 --- a/tests/unit/data/_async/test_client.py +++ b/tests/unit/data/_async/test_client.py @@ -283,7 +283,9 @@ async def test__ping_and_warm_single_instance(self): # should only have been called with test instance assert len(result) == 1 # check grpc call arguments - grpc_call_args = client_mock.transport.grpc_channel.unary_unary().call_args_list + grpc_call_args = ( + client_mock.transport.grpc_channel.unary_unary().call_args_list + ) assert len(grpc_call_args) == 1 kwargs = grpc_call_args[0][1] request = kwargs["request"] @@ -348,9 +350,7 @@ async def test__manage_channel_ping_and_warm(self): ping_and_warm = client_mock._ping_and_warm_instances = AsyncMock() # should ping and warm old channel then new if sleep > 0 try: - await self._get_target_class()._manage_channel( - client_mock, 10 - ) + await self._get_target_class()._manage_channel(client_mock, 10) except asyncio.CancelledError: pass # should have called at loop start, and after replacement @@ -501,7 +501,10 @@ async def test__register_instance(self): client_mock, "instance-2", table_mock2 ) assert client_mock._start_background_channel_refresh.call_count == 1 - assert client_mock._ping_and_warm_instances.call_args[0][0][0] == "prefix/instance-2" + assert ( + client_mock._ping_and_warm_instances.call_args[0][0][0] + == "prefix/instance-2" + ) # but it should call ping and warm with new instance key assert client_mock._ping_and_warm_instances.call_count == 1 # check for updated lists @@ -812,15 +815,11 @@ async def test_get_table_context_manager(self): @pytest.mark.asyncio async def test_close(self): - client = self._make_one( - project="project-id", use_emulator=False - ) + client = self._make_one(project="project-id", use_emulator=False) task = client._channel_refresh_task assert task is not None assert not task.done() - with mock.patch.object( - client.transport, "close", AsyncMock() - ) as close_mock: + with mock.patch.object(client.transport, "close", AsyncMock()) as close_mock: await client.close() close_mock.assert_called_once() close_mock.assert_awaited()