Skip to content

Commit 250bea3

Browse files
committed
Add tests to exercise the explicit default
1 parent f4b1826 commit 250bea3

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

sdk/storage/azure-storage-blob/tests/test_block_blob.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,4 +1984,21 @@ def test_upload_blob_copy_source_error_and_status_code(self, **kwargs):
19841984
finally:
19851985
self.bsc.delete_container(self.container_name)
19861986

1987+
@pytest.mark.live_test_only
1988+
@BlobPreparer()
1989+
def test_put_block_blob_with_none_concurrency(self, **kwargs):
1990+
storage_account_name = kwargs.pop("storage_account_name")
1991+
storage_account_key = kwargs.pop("storage_account_key")
1992+
1993+
self._setup(storage_account_name, storage_account_key)
1994+
blob_name = self._get_blob_reference()
1995+
blob = self.bsc.get_blob_client(self.container_name, blob_name)
1996+
data = b'a' * 5 * 1024
1997+
1998+
# max_concurrency=None should not raise TypeError
1999+
blob.upload_blob(data, max_concurrency=None, overwrite=True)
2000+
2001+
content = blob.download_blob().readall()
2002+
assert data == content
2003+
19872004
#------------------------------------------------------------------------------

sdk/storage/azure-storage-blob/tests/test_block_blob_async.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,4 +2102,21 @@ async def test_upload_blob_copy_source_error_and_status_code(self, **kwargs):
21022102
finally:
21032103
await self.bsc.delete_container(self.container_name)
21042104

2105+
@pytest.mark.live_test_only
2106+
@BlobPreparer()
2107+
async def test_put_block_blob_with_none_concurrency(self, **kwargs):
2108+
storage_account_name = kwargs.pop("storage_account_name")
2109+
storage_account_key = kwargs.pop("storage_account_key")
2110+
2111+
await self._setup(storage_account_name, storage_account_key)
2112+
blob_name = self._get_blob_reference()
2113+
blob = self.bsc.get_blob_client(self.container_name, blob_name)
2114+
data = b'a' * 5 * 1024
2115+
2116+
# max_concurrency=None should not raise TypeError
2117+
await blob.upload_blob(data, max_concurrency=None, overwrite=True)
2118+
2119+
content = await (await blob.download_blob()).readall()
2120+
assert data == content
2121+
21052122
# ------------------------------------------------------------------------------

sdk/storage/azure-storage-blob/tests/test_get_blob.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,4 +1663,19 @@ def test_get_blob_read_chars_utf32(self, **kwargs):
16631663
result += stream.readall()
16641664
assert result == data
16651665

1666+
@pytest.mark.live_test_only
1667+
@BlobPreparer()
1668+
def test_get_blob_to_bytes_with_none_concurrency(self, **kwargs):
1669+
storage_account_name = kwargs.pop("storage_account_name")
1670+
storage_account_key = kwargs.pop("storage_account_key")
1671+
1672+
self._setup(storage_account_name, storage_account_key)
1673+
blob = self.bsc.get_blob_client(self.container_name, self.byte_blob)
1674+
1675+
# max_concurrency=None should not raise TypeError
1676+
stream = blob.download_blob(max_concurrency=None)
1677+
content = stream.readall()
1678+
1679+
assert self.byte_data == content
1680+
16661681
# ------------------------------------------------------------------------------

sdk/storage/azure-storage-blob/tests/test_get_blob_async.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,4 +1815,19 @@ async def test_get_blob_read_chars_utf32(self, **kwargs):
18151815
result += await stream.readall()
18161816
assert result == data
18171817

1818+
@pytest.mark.live_test_only
1819+
@BlobPreparer()
1820+
async def test_get_blob_to_bytes_with_none_concurrency(self, **kwargs):
1821+
storage_account_name = kwargs.pop("storage_account_name")
1822+
storage_account_key = kwargs.pop("storage_account_key")
1823+
1824+
await self._setup(storage_account_name, storage_account_key)
1825+
blob = self.bsc.get_blob_client(self.container_name, self.byte_blob)
1826+
1827+
# max_concurrency=None should not raise TypeError
1828+
stream = await blob.download_blob(max_concurrency=None)
1829+
content = await stream.readall()
1830+
1831+
assert self.byte_data == content
1832+
18181833
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)