Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion google/cloud/storage/_media/requests/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ def _write_to_stream(self, response):
msg += content_length_msg
raise DataCorruption(response, msg)


def consume(
self,
transport,
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def write(self, b):
self._buffer.seek(0, io.SEEK_END)
pos = self._buffer.write(b)
self._buffer.seek(bookmark)
return self._cursor + pos
return pos

def read(self, size=-1):
"""Read and move the cursor."""
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/test_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,14 @@ def test_write(self, mock_warn):

# Write under chunk_size. This should be buffered and the upload not
# initiated.
writer.write(TEST_BINARY_DATA[0:4])
w1 = writer.write(TEST_BINARY_DATA[0:4])
self.assertEqual(w1, 4)
blob._initiate_resumable_upload.assert_not_called()

# Write over chunk_size. This should result in upload initialization
# and multiple chunks uploaded.
writer.write(TEST_BINARY_DATA[4:32])
w2 = writer.write(TEST_BINARY_DATA[4:32])
self.assertEqual(w2, 28)
blob._initiate_resumable_upload.assert_called_once_with(
blob.bucket.client,
writer._buffer,
Expand Down