def test_do_subject_files_exist_with_custom_dir_None(): expected_subjects_dir = os.path.join(TEST_DATA_DIR, 'extra_subjects') if not os.path.isdir(expected_subjects_dir): pytest.skip("Test data missing: e.g., directory '%s' does not exist. You can get all test data by running './develop/get_test_data_all.bash' in the repo root." % expected_subjects_dir) subjects_dir = expected_subjects_dir subjects_list = ['subject2x', 'subject3x'] missing = nit.do_subject_files_exist(subjects_list, subjects_dir, filename='subject2x.txt', sub_dir=None) assert len(missing) == 1 assert 'subject3x' in missing
def test_do_subject_files_exist_not_there(): subjects_dir = TEST_DATA_DIR subjects_file = os.path.join(subjects_dir, 'subjects.txt') subjects_list = nit.read_subjects_file(subjects_file) assert len(subjects_list) == 5 missing = nit.do_subject_files_exist(subjects_list, subjects_dir, filename='not_there') assert len(missing) == 5 assert 'subject1' in missing assert 'subject2' in missing assert 'subject3' in missing assert 'subject4' in missing assert 'subject5' in missing
def test_do_subject_files_exist_lh_area(): expected_subjects_dir = TEST_DATA_DIR expected_fsaverage_surf_dir = os.path.join(TEST_DATA_DIR, 'fsaverage', 'surf') if not os.path.isdir(expected_fsaverage_surf_dir): pytest.skip("Test data missing: e.g., directory '%s' does not exist. You can get all test data by running './develop/get_test_data_all.bash' in the repo root." % expected_fsaverage_surf_dir) subjects_dir = TEST_DATA_DIR subjects_file = os.path.join(subjects_dir, 'subjects.txt') subjects_list = nit.read_subjects_file(subjects_file) assert len(subjects_list) == 5 missing = nit.do_subject_files_exist(subjects_list, subjects_dir, filename='lh.area') assert len(missing) == 0
def test_do_subject_files_exist_template_for_existing_files(): subjects_dir = os.path.join(TEST_DATA_DIR, 'empty_subjects') subjects_file = os.path.join(subjects_dir, 'subjects_empty.txt') subjects_list = nit.read_subjects_file(subjects_file) assert len(subjects_list) == 3 expected_missing_file1 = os.path.join(subjects_dir, 'empty1', 'surf', 'empty1_not_there.txt') expected_missing_file2 = os.path.join(subjects_dir, 'empty2', 'surf', 'empty2_not_there.txt') expected_missing_file3 = os.path.join(subjects_dir, 'empty3', 'surf', 'empty3_not_there.txt') missing = nit.do_subject_files_exist(subjects_list, subjects_dir, filename_template='${SUBJECT_ID}_not_there.txt') assert len(missing) == 3 assert missing['empty1'] == expected_missing_file1 assert missing['empty2'] == expected_missing_file2 assert missing['empty3'] == expected_missing_file3