Skip to content

Commit c4ebb64

Browse files
committed
TEST: Regression test for stringified intents
1 parent 7ffffc2 commit c4ebb64

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

sdcflows/utils/tests/test_wrangler.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,43 @@
9595
}
9696
}
9797
]
98+
},
99+
{
100+
"session": "04",
101+
"anat": [{"suffix": "T1w", "metadata": {"EchoTime": 1}}],
102+
"fmap": [
103+
{"suffix": "epi", "dir": "AP", "metadata": {
104+
"EchoTime": 1.2,
105+
"PhaseEncodingDirection": "j-",
106+
"TotalReadoutTime": 0.8,
107+
"IntendedFor": [
108+
"ses-04/func/sub-01_ses-04_task-rest_run-1_bold.nii.gz",
109+
"ses-04/func/sub-01_ses-04_task-rest_run-2_bold.nii.gz",
110+
],
111+
}},
112+
],
113+
"func": [
114+
{
115+
"task": "rest",
116+
"run": 1,
117+
"suffix": "bold",
118+
"metadata": {
119+
"RepetitionTime": 0.8,
120+
"TotalReadoutTime": 0.5,
121+
"PhaseEncodingDirection": "j"
122+
}
123+
},
124+
{
125+
"task": "rest",
126+
"run": 2,
127+
"suffix": "bold",
128+
"metadata": {
129+
"RepetitionTime": 0.8,
130+
"TotalReadoutTime": 0.5,
131+
"PhaseEncodingDirection": "j"
132+
}
133+
},
134+
]
98135
}
99136
]
100137
}
@@ -216,3 +253,20 @@ def test_wrangler_filter(tmpdir, name, skeleton, estimations):
216253
est = find_estimators(layout=layout, subject='01', bids_filters=filters['fmap'])
217254
assert len(est) == estimations
218255
clear_registry()
256+
257+
258+
def test_single_reverse_pedir(tmp_path):
259+
bids_dir = tmp_path / "bids"
260+
generate_bids_skeleton(bids_dir, pepolar)
261+
layout = gen_layout(bids_dir)
262+
est = find_estimators(layout=layout, subject='01', bids_filters={'session': '04'})
263+
assert len(est) == 2
264+
subject_root = bids_dir / 'sub-01'
265+
for estimator in est:
266+
assert len(estimator.sources) == 2
267+
epi, bold = estimator.sources
268+
# Just checking order
269+
assert epi.entities['fmap'] == 'epi'
270+
# IntendedFor is a list of strings
271+
# REGRESSION: The result was a PyBIDS BIDSFile (fmriprep#3020)
272+
assert epi.metadata['IntendedFor'] == [str(bold.path.relative_to(subject_root))]

0 commit comments

Comments
 (0)