@@ -23,37 +23,33 @@ def test_update_complex_name():
2323 # Standard name update
2424 base_fn = 'sub-X_ses-Y_task-Z_run-01_sbref'
2525 metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'P' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
26- file_counter = 3 # This is the third file with the same name
2726 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 )
2928 assert out_fn_test == out_fn_true
3029
3130 # Catch an unsupported type and *do not* update
3231 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 )
3433 assert out_fn_test == base_fn
3534
36- # Data type is missing from metadata so use suffix
35+ # Data type is missing from metadata so raise a RuntimeError
3736 base_fn = 'sub-X_ses-Y_task-Z_run-01_sbref'
3837 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 )
4240
4341 # Catch existing field with value (part is already in the filename)
4442 # that *does not match* metadata and raise Exception
4543 base_fn = 'sub-X_ses-Y_task-Z_run-01_part-mag_sbref'
4644 metadata = {'ImageType' : ['ORIGINAL' , 'PRIMARY' , 'P' , 'MB' , 'TE3' , 'ND' , 'MOSAIC' ]}
47- file_counter = 3
4845 with pytest .raises (BIDSError ):
49- update_complex_name (metadata , base_fn , file_counter )
46+ update_complex_name (metadata , base_fn )
5047
5148 # Catch existing field with value (part is already in the filename)
5249 # that *does match* metadata and do not update
5350 base_fn = 'sub-X_ses-Y_task-Z_run-01_part-phase_sbref'
5451 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 )
5753 assert out_fn_test == base_fn
5854
5955
0 commit comments