@@ -260,25 +260,37 @@ async def test_downloading_without_opening_should_throw_error(
260260 assert str (exc .value ) == "Underlying bidi-gRPC stream is not open"
261261 assert not mrd .is_stream_open
262262
263- @mock .patch ("google.cloud.storage._experimental.asyncio.async_multi_range_downloader.google_crc32c" )
264- @mock .patch ("google.cloud.storage._experimental.asyncio.async_grpc_client.AsyncGrpcClient.grpc_client" )
263+ @mock .patch (
264+ "google.cloud.storage._experimental.asyncio.async_multi_range_downloader.google_crc32c"
265+ )
266+ @mock .patch (
267+ "google.cloud.storage._experimental.asyncio.async_grpc_client.AsyncGrpcClient.grpc_client"
268+ )
265269 def test_init_raises_if_crc32c_c_extension_is_missing (
266270 self , mock_grpc_client , mock_google_crc32c
267271 ):
268272 mock_google_crc32c .implementation = "python"
269273
270274 with pytest .raises (exceptions .NotFound ) as exc_info :
271- AsyncMultiRangeDownloader (
272- mock_grpc_client , "bucket" , "object"
273- )
275+ AsyncMultiRangeDownloader (mock_grpc_client , "bucket" , "object" )
274276
275- assert "The google-crc32c package is not installed with C support" in str (exc_info .value )
277+ assert "The google-crc32c package is not installed with C support" in str (
278+ exc_info .value
279+ )
276280
277281 @pytest .mark .asyncio
278- @mock .patch ("google.cloud.storage._experimental.asyncio.async_multi_range_downloader.Checksum" )
279- @mock .patch ("google.cloud.storage._experimental.asyncio.async_grpc_client.AsyncGrpcClient.grpc_client" )
280- async def test_download_ranges_raises_on_checksum_mismatch (self , mock_client , mock_checksum_class ):
281- mock_stream = mock .AsyncMock (spec = async_read_object_stream ._AsyncReadObjectStream )
282+ @mock .patch (
283+ "google.cloud.storage._experimental.asyncio.async_multi_range_downloader.Checksum"
284+ )
285+ @mock .patch (
286+ "google.cloud.storage._experimental.asyncio.async_grpc_client.AsyncGrpcClient.grpc_client"
287+ )
288+ async def test_download_ranges_raises_on_checksum_mismatch (
289+ self , mock_client , mock_checksum_class
290+ ):
291+ mock_stream = mock .AsyncMock (
292+ spec = async_read_object_stream ._AsyncReadObjectStream
293+ )
282294
283295 test_data = b"some-data"
284296 server_checksum = 12345
@@ -299,9 +311,7 @@ async def test_download_ranges_raises_on_checksum_mismatch(self, mock_client, mo
299311
300312 mock_stream .recv .side_effect = [mock_response , None ]
301313
302- mrd = AsyncMultiRangeDownloader (
303- mock_client , "bucket" , "object"
304- )
314+ mrd = AsyncMultiRangeDownloader (mock_client , "bucket" , "object" )
305315 mrd .read_obj_str = mock_stream
306316 mrd ._is_stream_open = True
307317
@@ -310,4 +320,3 @@ async def test_download_ranges_raises_on_checksum_mismatch(self, mock_client, mo
310320
311321 assert "Checksum mismatch" in str (exc_info .value )
312322 mock_checksum_class .assert_called_once_with (test_data )
313-
0 commit comments