Skip to content

Commit 97f637a

Browse files
psadileffigies
andauthored
use variables while populating the directory and a dictionary when preparing to call collect_derivatives
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
1 parent bef2a21 commit 97f637a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

fmriprep/utils/tests/test_derivative_cache.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,28 @@
99

1010
@pytest.mark.parametrize('xfm', ['boldref2fmap', 'boldref2anat', 'hmc'])
1111
def test_transforms_found_as_str(tmp_path: Path, xfm: str):
12+
sub = '0'
13+
task = 'rest'
14+
fromto = {
15+
'hmc': 'from-orig_to-boldref',
16+
'boldref2fmap': 'from-boldref_to-auto00000',
17+
'boldref2anat': 'from-boldref_to-anat',
18+
}[xfm]
19+
20+
to_find = tmp_path.joinpath(
21+
f'sub-{subject}',
22+
'func',
23+
f'sub-{subject}_task-{task}_{fromto}_mode-image_xfm.txt'
24+
)
25+
to_find.parent.mkdir(parents=True)
26+
to_find.touch()
27+
1228
entities = {
13-
'subject': '0',
14-
'task': 'rest',
29+
'subject': subject,
30+
'task': task,
1531
'suffix': 'bold',
1632
'extension': '.nii.gz',
1733
}
18-
if xfm == 'boldref2fmap':
19-
to_find = f'sub-{entities["subject"]}_task-{entities["task"]}_from-{spec["from"]}_to-auto00000_mode-image_xfm.txt' # noqa: E501
20-
else:
21-
to_find = f'sub-{entities["subject"]}_task-{entities["task"]}_from-{spec["from"]}_to-{spec["to"]}_mode-image_xfm.txt' # noqa: E501
22-
23-
funcd = tmp_path / f'sub-{entities["subject"]}' / 'func'
24-
funcd.mkdir(parents=True)
25-
(funcd / to_find).touch()
2634

2735
derivs = bids.collect_derivatives(
2836
derivatives_dir=tmp_path,

0 commit comments

Comments
 (0)