@@ -409,15 +409,17 @@ def test_write_scans_tsv_with_out_dir(tmp_path):
409409 '/source/file2.nii.gz' : [str (subject_dir / 'func' / 'sub-01_bold.nii.gz' )],
410410 }
411411 ingress_utils .write_scans_tsv (copy_dict , str (subject_dir ), 'sub-01' , out_dir = str (out_dir ))
412-
412+
413413 # Check that scans.tsv exists in subject directory
414414 subject_scans_tsv = subject_dir / 'sub-01_scans.tsv'
415415 assert subject_scans_tsv .exists ()
416-
416+
417417 # Check that scans.tsv is also copied to sourcedata/bids_conversion/sub-01/
418- sourcedata_scans_tsv = out_dir / 'sourcedata' / 'bids_conversion' / 'sub-01' / 'sub-01_scans.tsv'
418+ sourcedata_scans_tsv = (
419+ out_dir / 'sourcedata' / 'bids_conversion' / 'sub-01' / 'sub-01_scans.tsv'
420+ )
419421 assert sourcedata_scans_tsv .exists ()
420-
422+
421423 # Verify both files have the same content
422424 df_subject = pd .read_csv (subject_scans_tsv , sep = '\t ' )
423425 df_sourcedata = pd .read_csv (sourcedata_scans_tsv , sep = '\t ' )
@@ -434,16 +436,25 @@ def test_write_scans_tsv_with_session(tmp_path):
434436 copy_dict = {
435437 '/source/bold.nii.gz' : [str (subject_dir / 'func' / 'sub-01_ses-01_bold.nii.gz' )],
436438 }
437- ingress_utils .write_scans_tsv (copy_dict , str (subject_dir ), 'sub-01_ses-01' , out_dir = str (out_dir ))
438-
439+ ingress_utils .write_scans_tsv (
440+ copy_dict , str (subject_dir ), 'sub-01_ses-01' , out_dir = str (out_dir )
441+ )
442+
439443 # Check both locations
440444 subject_scans_tsv = subject_dir / 'sub-01_ses-01_scans.tsv'
441445 assert subject_scans_tsv .exists ()
442-
446+
443447 # Check sourcedata/bids_conversion/sub-01/ses-01/
444- sourcedata_scans_tsv = out_dir / 'sourcedata' / 'bids_conversion' / 'sub-01' / 'ses-01' / 'sub-01_ses-01_scans.tsv'
448+ sourcedata_scans_tsv = (
449+ out_dir
450+ / 'sourcedata'
451+ / 'bids_conversion'
452+ / 'sub-01'
453+ / 'ses-01'
454+ / 'sub-01_ses-01_scans.tsv'
455+ )
445456 assert sourcedata_scans_tsv .exists ()
446-
457+
447458 df = pd .read_csv (sourcedata_scans_tsv , sep = '\t ' )
448459 assert len (df ) == 1
449460 assert 'sub-01_ses-01_bold.nii.gz' in df ['filename' ].values [0 ]
0 commit comments