Skip to content

Commit 73019f2

Browse files
Update test_dcm2nii.py
1 parent e447b92 commit 73019f2

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

nipype/interfaces/tests/test_dcm2nii.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@
55

66

77
@pytest.mark.parametrize(
8-
"fname, extension",
8+
"fname, extension, search_crop",
99
[
10-
("output_1", ".txt"),
11-
("output_w_[]_meta_1", ".json"),
12-
("output_w_**^$?_meta_2", ".txt"),
10+
("output_1", ".txt", False),
11+
("output_w_[]_meta_1", ".json", False),
12+
("output_w_**^$?_meta_2", ".txt", False),
13+
("output_cropped", ".txt", True),
1314
],
1415
)
15-
def test_search_files(tmp_path, fname, extension):
16+
def test_search_files(tmp_path, fname, extension, search_crop):
1617
tmp_fname = fname + extension
1718
test_file = tmp_path / tmp_fname
1819
test_file.touch()
19-
actual_files_list = dcm2nii.search_files(str(tmp_path / fname), [extension])
20+
if search_crop:
21+
tmp_cropped_fname = fname + "_Crop_1" + extension
22+
test_cropped_file = tmp_path / tmp_cropped_fname
23+
test_cropped_file.touch()
24+
25+
actual_files_list = dcm2nii.search_files(str(tmp_path / fname), [extension], search_crop)
2026
for f in actual_files_list:
21-
assert str(test_file) == f
27+
if search_crop:
28+
assert (f in (str(test_cropped_file), str(test_file)))
29+
else:
30+
assert str(test_file) == f

0 commit comments

Comments
 (0)