Skip to content

Commit

Permalink
tests: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Nov 24, 2020
1 parent 0f434fb commit 3801122
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tests/unit/test_blob.py
Expand Up @@ -1642,8 +1642,6 @@ def _download_as_text_helper(
if payload is None:
if encoding is not None:
payload = expected_value.encode(encoding)
elif charset is not None:
payload = expected_value.encode(charset)
else:
payload = expected_value.encode()

Expand Down Expand Up @@ -1696,8 +1694,8 @@ def _download_as_text_helper(

blob.download_as_bytes.assert_called_once_with(
client=client,
start=client,
end=client,
start=start,
end=end,
raw_download=raw_download,
timeout=expected_timeout,
if_generation_match=if_generation_match,
Expand All @@ -1712,6 +1710,15 @@ def test_download_as_text_wo_raw(self):
def test_download_as_text_w_raw(self):
self._download_as_text_helper(raw_download=True)

def test_download_as_text_w_client(self):
self._download_as_text_helper(raw_download=False, client=object())

def test_download_as_text_w_start(self):
self._download_as_text_helper(raw_download=False, start=123)

def test_download_as_text_w_end(self):
self._download_as_text_helper(raw_download=False, end=456)

def test_download_as_text_w_custom_timeout(self):
self._download_as_text_helper(raw_download=False, timeout=9.58)

Expand All @@ -1727,6 +1734,17 @@ def test_download_as_text_w_if_metageneration_match(self):
def test_download_as_text_w_if_metageneration_not_match(self):
self._download_as_text_helper(raw_download=False, if_metageneration_not_match=6)

def test_download_as_text_w_encoding(self):
encoding = "utf-16"
self._download_as_text_helper(
raw_download=False, encoding=encoding,
)

def test_download_as_text_w_no_charset(self):
self._download_as_text_helper(
raw_download=False, no_charset=True,
)

def test_download_as_text_w_non_ascii_w_explicit_encoding(self):
expected_value = u"\x0AFe"
encoding = "utf-16"
Expand Down

0 comments on commit 3801122

Please sign in to comment.