Skip to content

Commit e32082b

Browse files
author
oliver-contier
committed
reference run can now be given as string ('first', 'last', 'middle). Also added rudimentary tests
1 parent 4ba48c4 commit e32082b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

nipype/workflows/fmri/fsl/preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def getthreshop(thresh):
1919
def pickrun(files, whichrun):
2020
"""pick file from list of files"""
2121

22-
filemap = {'first': 0, 'last': -1, 'middle' :len(files) // 2}
22+
filemap = {'first': 0, 'last': -1, 'middle': len(files) // 2}
2323

2424
if isinstance(whichrun, str):
2525
if whichrun not in filemap.keys():

nipype/workflows/fmri/fsl/tests/test_preprocess.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44

55

66
def test_pickrun():
7-
files = ['1', '2', '3']
7+
files = ['1', '2', '3', '4']
88
assert pickrun(files, 0) == '1'
9-
assert pickrun(files, -1) == '3'
9+
assert pickrun(files, 'first') == '1'
10+
assert pickrun(files, -1) == '4'
11+
assert pickrun(files, 'last') == '4'
12+
assert pickrun(files, 'middle') == '3'
1013

1114

1215
def test_create_featreg_preproc():
13-
# smoke test
16+
"""smoke test"""
1417
wf = create_featreg_preproc(whichrun=0)
15-
wf.get_node('extractref')
16-
assert wf._get_dot()
18+
19+
# test type
20+
import nipype
21+
assert type(wf) == nipype.pipeline.engine.Workflow
22+
23+
# test methods
24+
assert wf.get_node('extractref')
25+
assert wf._get_dot()

0 commit comments

Comments
 (0)