Skip to content

Commit

Permalink
update test for parsing and querying derivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Feb 15, 2021
1 parent e8ea572 commit e318a43
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
36 changes: 24 additions & 12 deletions tests/test_layout_derivatives.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,31 @@ function test_layout_schemaless()
assertEqual(bids.query(BIDS, 'modalities'), modalities);

% Those fail for now
% data = bids.query(BIDS, 'data', ...
% 'sub', '10', ...
% 'modality', 'func', ...
% 'suffix', 'bold', ...
% 'run', '1', ...
% 'res', '2');
% data = bids.query(BIDS, 'data', ...
% 'sub', '10', ...
% 'modality', 'func', ...
% 'suffix', 'bold', ...
% 'run', '1', ...
% 'space', 'MNI152NLin6Asym');
data = bids.query(BIDS, 'data', ...
'sub', '10', ...
'modality', 'func', ...
'suffix', 'bold', ...
'run', '1', ...
'res', '2');

basename = bids.internal.file_utils(data, 'basename');
assertEqual(basename, {
['sub-10_task-balloonanalogrisktask_run-1', ...
'_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii']
});

data = bids.query(BIDS, 'data', ...
'sub', '10', ...
'modality', 'func', ...
'suffix', 'bold', ...
'run', '1', ...
'space', 'MNI152NLin6Asym');

basename = bids.internal.file_utils(data, 'basename');
assertEqual(basename, {
['sub-10_task-balloonanalogrisktask_run-1', ...
'_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii']
});
end

function test_layout_nested_derivatives()
Expand Down
4 changes: 3 additions & 1 deletion tests/test_load_schema.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ function test_load_schema_path()
assert(isfield(schema, 'base'));
assert(isfield(schema, 'subfolder_1'));
assert(isfield(schema.subfolder_1, 'sub'));
assert(~isfield(schema, 'subfolder_4'));

% some recursive aspects are not implemented yet
% assert(isfield(schema.subfolder_2, 'subfolder_3'));
% assert(isfield(schema.subfolder_2.subfolder_3, 'sub'));
assert(~isfield(schema, 'subfolder_4'));

end

Expand Down
12 changes: 0 additions & 12 deletions tests/test_parse_filename.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ function test_parse_filename_basic()
'run', '1', ...
'acq', 'hd'));

% expected = struct( ...
% 'filename', 'sub-16_ses-mri_run-1_acq-hd_T1w.nii.gz', ...
% 'suffix', 'T1w', ...
% 'ext', '.nii.gz', ...
% 'sub', '16', ...
% 'ses', 'mri', ...
% 'run', '1', ...
% 'acq', 'hd', ...
% 'ce', '', ...
% 'rec', '', ...
% 'part', '');

assertEqual(output, expected);

end
Expand Down

0 comments on commit e318a43

Please sign in to comment.