Skip to content

Commit 1bd151b

Browse files
committed
Add test for populate_intended_for using heuristic without POPULATE_INTENDED_FOR_OPTS
Use reproin heuristic
1 parent 5a06034 commit 1bd151b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

heudiconv/tests/test_convert.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_b0dwi_for_fmap(tmpdir, capfd):
126126
)
127127
# Two possibilities: with or without heuristics:
128128
@pytest.mark.parametrize(
129-
"heuristic", ['example', None] # heuristics/example.py
129+
"heuristic", ['example', 'reproin', None] # heuristics/example.py, heuristics/reproin.py
130130
)
131131
def test_populate_intended_for(tmpdir, monkeypatch, capfd,
132132
subjects, sesID, expected_session_folder,
@@ -163,7 +163,7 @@ def mock_populate_intended_for(session, matching_parameter='Shims', criterion='C
163163
for s in subjects
164164
]
165165

166-
heuristic = load_heuristic('example') if heuristic else None
166+
heuristic = load_heuristic(heuristic) if heuristic else None
167167
heudiconv.convert.convert(items,
168168
converter='',
169169
scaninfo_suffix='.json',
@@ -175,12 +175,14 @@ def mock_populate_intended_for(session, matching_parameter='Shims', criterion='C
175175
min_meta=True,
176176
overwrite=False)
177177
output = capfd.readouterr()
178-
if heuristic:
178+
# if the heuristic module has a 'POPULATE_INTENDED_FOR_OPTS' field, we expect
179+
# to get the output of the mock_populate_intended_for, otherwise, no output:
180+
if getattr(heuristic, 'POPULATE_INTENDED_FOR_OPTS', None):
179181
assert all([
180182
"\n".join([
181183
"session: " + outfolder.format(sID=s, ses=sesID),
182184
# "ImagingVolume" is defined in heuristic file; "Shims" is the default
183-
"matching_parameter: " + ("ImagingVolume" if heuristic else "Shims"),
185+
"matching_parameter: " + "ImagingVolume",
184186
"criterion: Closest"
185187
]) in output.out
186188
for s in subjects

0 commit comments

Comments
 (0)