Skip to content

Commit 9ffd8de

Browse files
committed
Rename to assert_complete_download
1 parent 8d35d4b commit 9ffd8de

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/virtualship/cli/_fetch.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ def get_existing_download(data_folder: Path, aoi_hash: str) -> Path | None:
8585
continue
8686

8787
if hash == aoi_hash:
88-
check_complete_download(download_path)
88+
assert_complete_download(download_path)
8989
return download_path
9090

9191
return None
9292

9393

94-
def check_complete_download(download_path: Path) -> bool:
95-
"""Check if a download is complete."""
94+
def assert_complete_download(download_path: Path) -> None:
9695
download_metadata = download_path / DOWNLOAD_METADATA
9796
try:
9897
with open(download_metadata) as file:
@@ -102,7 +101,7 @@ def check_complete_download(download_path: Path) -> bool:
102101
f"Download at {download_path} was found, but looks to be incomplete "
103102
f"(likely due to interupting it mid-download). Please delete this folder and retry."
104103
) from e
105-
return True
104+
return
106105

107106

108107
def complete_download(download_path: Path) -> None:

tests/cli/test_fetch.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
DOWNLOAD_METADATA,
88
DownloadMetadata,
99
IncompleteDownloadError,
10-
check_complete_download,
10+
assert_complete_download,
1111
complete_download,
1212
create_hash,
1313
filename_to_hash,
@@ -42,27 +42,27 @@ def test_complete_download(tmp_path):
4242

4343
complete_download(tmp_path)
4444

45-
assert check_complete_download(tmp_path)
45+
assert_complete_download(tmp_path)
4646

4747

48-
def test_check_complete_download_complete(tmp_path):
48+
def test_assert_complete_download_complete(tmp_path):
4949
# Setup
5050
DownloadMetadata(download_complete=True).to_yaml(tmp_path / DOWNLOAD_METADATA)
5151

52-
assert check_complete_download(tmp_path)
52+
assert_complete_download(tmp_path)
5353

5454

55-
def test_check_complete_download_incomplete(tmp_path):
55+
def test_assert_complete_download_incomplete(tmp_path):
5656
# Setup
5757
DownloadMetadata(download_complete=False).to_yaml(tmp_path / DOWNLOAD_METADATA)
5858

5959
with pytest.raises(IncompleteDownloadError):
60-
check_complete_download(tmp_path)
60+
assert_complete_download(tmp_path)
6161

6262

63-
def test_check_complete_download_missing(tmp_path):
63+
def test_assert_complete_download_missing(tmp_path):
6464
with pytest.raises(IncompleteDownloadError):
65-
assert not check_complete_download(tmp_path)
65+
assert_complete_download(tmp_path)
6666

6767

6868
@pytest.fixture
@@ -76,7 +76,7 @@ def existing_data_folder(tmp_path, monkeypatch):
7676
]
7777
data_folder = tmp_path
7878
monkeypatch.setattr(
79-
"virtualship.cli._fetch.check_complete_download", lambda x: True
79+
"virtualship.cli._fetch.assert_complete_download", lambda x: None
8080
)
8181
for f in folders:
8282
(data_folder / f).mkdir()

0 commit comments

Comments
 (0)