Skip to content

Commit 1d401fa

Browse files
author
Jan Sebastian Rothe
committed
Add test for when the file name defaults to version 1
1 parent 871bebf commit 1d401fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/paths/test_versions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ def test_next_version_number(mock_latest_version_path, mock_get_fileversions):
7070
assert next_version_number(filepath) == 3
7171

7272

73+
# Test for `latest_version_path` function to check if it defaults to '_v1'
74+
@patch("fagfunksjoner.paths.versions.get_fileversions")
75+
@patch("fagfunksjoner.paths.versions.construct_file_pattern")
76+
def test_latest_version_path_defaults_to_v1(
77+
mock_construct_file_pattern, mock_get_fileversions
78+
):
79+
mock_get_fileversions.return_value = []
80+
mock_construct_file_pattern.return_value = "gs://bucket/folder/file_v1.parquet"
81+
filepath = "gs://bucket/folder/file.parquet"
82+
assert latest_version_path(filepath) == "gs://bucket/folder/file_v1.parquet"
83+
84+
7385
# Test for `next_version_path` function with Google Storage path
7486
@patch("fagfunksjoner.paths.versions.get_fileversions")
7587
@patch("fagfunksjoner.paths.versions.latest_version_path")

0 commit comments

Comments
 (0)