Skip to content

Commit

Permalink
Merge branch 'main' into page-size
Browse files Browse the repository at this point in the history
  • Loading branch information
cojenco committed May 16, 2024
2 parents 3965c32 + 4db96c9 commit ee7a89f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def storage_get_started(to_delete):
bucket = client.get_bucket("bucket-id-here")
# Then do other things...
blob = bucket.get_blob("/remote/path/to/file.txt")
assert blob.download_as_string() == b"My old contents!"
assert blob.download_as_bytes() == b"My old contents!"
blob.upload_from_string("New contents!")
blob2 = bucket.blob("/remote/path/storage.txt")
blob2.upload_from_filename(filename="/local/path.txt")
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/encryption_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ def test_object_csek_to_cmek(test_blob):
BUCKET, test_blob_name, TEST_ENCRYPTION_KEY_2, KMS_KEY
)

assert cmek_blob.download_as_string(), test_blob_content
assert cmek_blob.download_as_bytes(), test_blob_content
4 changes: 2 additions & 2 deletions samples/snippets/rpo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
def dual_region_bucket():
"""Yields a dual region bucket that is deleted after the test completes."""
bucket = None
location = "NAM4"
while bucket is None or bucket.exists():
bucket_name = f"bucket-lock-{uuid.uuid4()}"
bucket = storage.Client().bucket(bucket_name)
bucket.location = "NAM4"
bucket.create()
bucket.create(location=location)
yield bucket
bucket.delete(force=True)

Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/storage_create_bucket_turbo_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def create_bucket_turbo_replication(bucket_name):

storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
bucket.location = "NAM4"
bucket_location = "NAM4"
bucket.rpo = RPO_ASYNC_TURBO
bucket.create()
bucket.create(location=bucket_location)

print(f"{bucket.name} created with the recovery point objective (RPO) set to {bucket.rpo} in {bucket.location}.")

Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def test_blob_upload_download_crc32_md5_hash(

download_blob = shared_bucket.blob("MyBuffer")

assert download_blob.download_as_string() == payload
assert download_blob.download_as_bytes() == payload
assert download_blob.crc32c == blob.crc32c
assert download_blob.md5_hash == blob.md5_hash

Expand Down
6 changes: 3 additions & 3 deletions tests/system/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ def test_bucket_copy_blob_w_metageneration_match(
):
payload = b"DEADBEEF"
bucket_name = _helpers.unique_name("generation-match")
created = _helpers.retry_429_503(storage_client.create_bucket)(
bucket_name, requester_pays=True
)
bucket = storage_client.bucket(bucket_name)
bucket.requester_pays = True
created = _helpers.retry_429_503(storage_client.create_bucket)(bucket)
buckets_to_delete.append(created)
assert created.name == bucket_name

Expand Down

0 comments on commit ee7a89f

Please sign in to comment.