Skip to content

Commit

Permalink
Update test_dcm2nii.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriliogenovese committed Mar 21, 2024
1 parent e447b92 commit 73019f2
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions nipype/interfaces/tests/test_dcm2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@


@pytest.mark.parametrize(
"fname, extension",
"fname, extension, search_crop",
[
("output_1", ".txt"),
("output_w_[]_meta_1", ".json"),
("output_w_**^$?_meta_2", ".txt"),
("output_1", ".txt", False),
("output_w_[]_meta_1", ".json", False),
("output_w_**^$?_meta_2", ".txt", False),
("output_cropped", ".txt", True),
],
)
def test_search_files(tmp_path, fname, extension):
def test_search_files(tmp_path, fname, extension, search_crop):
tmp_fname = fname + extension
test_file = tmp_path / tmp_fname
test_file.touch()
actual_files_list = dcm2nii.search_files(str(tmp_path / fname), [extension])
if search_crop:
tmp_cropped_fname = fname + "_Crop_1" + extension
test_cropped_file = tmp_path / tmp_cropped_fname
test_cropped_file.touch()

actual_files_list = dcm2nii.search_files(str(tmp_path / fname), [extension], search_crop)
for f in actual_files_list:
assert str(test_file) == f
if search_crop:
assert (f in (str(test_cropped_file), str(test_file)))
else:
assert str(test_file) == f

0 comments on commit 73019f2

Please sign in to comment.