@@ -23,37 +23,33 @@ def test_update_complex_name():
23
23
# Standard name update
24
24
base_fn = 'sub-X_ses-Y_task-Z_run-01_sbref'
25
25
metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'P' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
26
- file_counter = 3 # This is the third file with the same name
27
26
out_fn_true = 'sub-X_ses-Y_task-Z_run-01_part-phase_sbref'
28
- out_fn_test = update_complex_name (metadata , base_fn , file_counter )
27
+ out_fn_test = update_complex_name (metadata , base_fn )
29
28
assert out_fn_test == out_fn_true
30
29
31
30
# Catch an unsupported type and *do not* update
32
31
base_fn = 'sub-X_ses-Y_task-Z_run-01_phase'
33
- out_fn_test = update_complex_name (metadata , base_fn , file_counter )
32
+ out_fn_test = update_complex_name (metadata , base_fn )
34
33
assert out_fn_test == base_fn
35
34
36
- # Data type is missing from metadata so use suffix
35
+ # Data type is missing from metadata so raise a RuntimeError
37
36
base_fn = 'sub-X_ses-Y_task-Z_run-01_sbref'
38
37
metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
39
- out_fn_true = 'sub-X_ses-Y_task-Z_run-01_part-3_sbref'
40
- out_fn_test = update_complex_name (metadata , base_fn , file_counter )
41
- assert out_fn_test == out_fn_true
38
+ with pytest .raises (RuntimeError ):
39
+ update_complex_name (metadata , base_fn )
42
40
43
41
# Catch existing field with value (part is already in the filename)
44
42
# that *does not match* metadata and raise Exception
45
43
base_fn = 'sub-X_ses-Y_task-Z_run-01_part-mag_sbref'
46
44
metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'P' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
47
- file_counter = 3
48
45
with pytest .raises (BIDSError ):
49
- update_complex_name (metadata , base_fn , file_counter )
46
+ update_complex_name (metadata , base_fn )
50
47
51
48
# Catch existing field with value (part is already in the filename)
52
49
# that *does match* metadata and do not update
53
50
base_fn = 'sub-X_ses-Y_task-Z_run-01_part-phase_sbref'
54
51
metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'P' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
55
- file_counter = 3
56
- out_fn_test = update_complex_name (metadata , base_fn , file_counter )
52
+ out_fn_test = update_complex_name (metadata , base_fn )
57
53
assert out_fn_test == base_fn
58
54
59
55
0 commit comments