Skip to content

Commit 2fbe83d

Browse files
committed
add assert statements
1 parent 262480d commit 2fbe83d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

google/cloud/storage/_experimental/asyncio/async_appendable_object_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
if you want to use these Rapid Storage APIs.
2222
2323
"""
24-
from io import BytesIO, BufferedReader
24+
from io import BufferedReader
2525
from typing import Optional, Union
2626

2727
from google.api_core import exceptions

tests/unit/asyncio/test_async_appendable_object_writer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ async def test_append_data_two_times(mock_write_object_stream, mock_client):
598598
"file_size, block_size",
599599
[
600600
(10, 4 * 1024),
601+
(0, _DEFAULT_FLUSH_INTERVAL_BYTES),
601602
(20 * 1024 * 1024, _DEFAULT_FLUSH_INTERVAL_BYTES),
602603
(16 * 1024 * 1024, _DEFAULT_FLUSH_INTERVAL_BYTES),
603604
],
@@ -613,7 +614,9 @@ async def test_append_from_file(file_size, block_size, mock_client):
613614
await writer.append_from_file(fp, block_size=block_size)
614615

615616
# assert
616-
if file_size % block_size == 0:
617-
writer.append.await_count == file_size // block_size
618-
else:
619-
writer.append.await_count == file_size // block_size + 1
617+
exepected_calls = (
618+
file_size // block_size
619+
if file_size % block_size == 0
620+
else file_size // block_size + 1
621+
)
622+
assert writer.append.await_count == exepected_calls

0 commit comments

Comments
 (0)