|
5 | 5 |
|
6 | 6 |
|
7 | 7 | @pytest.mark.parametrize( |
8 | | - "fname, extension", |
| 8 | + "fname, extension, search_crop", |
9 | 9 | [ |
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), |
13 | 14 | ], |
14 | 15 | ) |
15 | | -def test_search_files(tmp_path, fname, extension): |
| 16 | +def test_search_files(tmp_path, fname, extension, search_crop): |
16 | 17 | tmp_fname = fname + extension |
17 | 18 | test_file = tmp_path / tmp_fname |
18 | 19 | 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) |
20 | 26 | 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