Skip to content

Commit 6aef9b7

Browse files
committed
chore: update sample tests and README to reflect new checksum defaults
1 parent 97732d7 commit 6aef9b7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@ downloads and None for most uploads. Note that ranged downloads ("start" or
8585
"end" set) still do not support any checksumming, and some features in
8686
`transfer_manager.py` still support crc32c only.
8787

88+
Note: The method `Blob.upload_from_file()` requires a file in bytes mode, but
89+
when checksum is set to None, as was the previous default, would not throw an
90+
error if passed a file in string mode under some circumstances. With the new
91+
defaults, it will now raise a TypeError. Please use a file opened in bytes
92+
reading mode as required.
93+
8894
Miscellaneous
8995
~~~~~~~~~~~~~
9096

91-
- The BlobWriter class now attempts to terminate an ongoing resumable upload if
97+
- The `BlobWriter` class now attempts to terminate an ongoing resumable upload if
9298
the writer exits with an exception.
9399
- Retry behavior is now identical between media operations (uploads and
94100
downloads) and other operations, and custom predicates are now supported for

samples/snippets/snippets_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ def test_upload_blob_from_memory(test_bucket, capsys):
233233

234234

235235
def test_upload_blob_from_stream(test_bucket, capsys):
236-
file_obj = io.StringIO()
237-
file_obj.write("This is test data.")
236+
file_obj = io.BytesIO()
237+
file_obj.write(b"This is test data.")
238238
storage_upload_from_stream.upload_blob_from_stream(
239239
test_bucket.name, file_obj, "test_upload_blob"
240240
)

0 commit comments

Comments
 (0)