Skip to content

Commit

Permalink
fixup! Add functionality for setting custom names
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellevstek committed Oct 18, 2024
1 parent b9661da commit d03aaf9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/resdk/resources/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def download_and_rename(
file_name: Optional[str] = None,
download_dir: Optional[str] = None,
):
"""Download and rename a single file from data object."""
"""Download and rename a single file from the Data object."""

if download_dir is None:
download_dir = os.getcwd()
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ def test_field_name(self, collection_mock):
collection_mock.configure_mock(data=[DATA0, DATA2], resolwe=MagicMock())
BaseCollection.download(collection_mock, field_name="output.exp")
flist = ["2/outfile.exp"]
collection_mock.resolwe._download_files.assert_called_once_with(
files=flist, download_dir=None
)
collection_mock.resolwe._download_files.assert_called_once_with(flist, None)

# Check if ``output_field`` does not start with 'output'
collection_mock.reset_mock()
collection_mock.configure_mock(data=[DATA1, DATA0], resolwe=MagicMock())
BaseCollection.download(collection_mock, field_name="fastq")
flist = ["1/reads.fq", "1/arch.gz"]
collection_mock.resolwe._download_files.assert_called_once_with(
files=flist, download_dir=None
)
collection_mock.resolwe._download_files.assert_called_once_with(flist, None)

def test_bad_field_name(self):
collection = Collection(resolwe=MagicMock(), id=1)
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,13 @@ def test_download_ok(self, data_mock):
data_mock.resolwe._download_files.assert_called_once_with(
files=["123/file1.txt", "123/file2.fq.gz"],
download_dir=None,
custom_file_names=None,
)

data_mock.reset_mock()
Data.download(data_mock, download_dir="/some/path/")
data_mock.resolwe._download_files.assert_called_once_with(
files=["123/file1.txt", "123/file2.fq.gz"],
download_dir="/some/path/",
custom_file_names=None,
)

data_mock.reset_mock()
Expand Down

0 comments on commit d03aaf9

Please sign in to comment.