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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy