Skip to content

Commit ac64c48

Browse files
committed
TEST: Add string function test
1 parent 6e21536 commit ac64c48

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

nipype/interfaces/utility/tests/test_wrappers.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
from nipype.interfaces import utility
99
import nipype.pipeline.engine as pe
1010

11+
concat_sort = """\
12+
def concat_sort(in_arrays):
13+
import numpy as np
14+
all_vals = np.concatenate([arr.flatten() for arr in in_arrays])
15+
return np.sort(all_vals)
16+
"""
1117

1218
def test_function(tmpdir):
1319
os.chdir(str(tmpdir))
@@ -27,6 +33,12 @@ def increment_array(in_array):
2733
f2 = pe.MapNode(utility.Function(function=increment_array), name='increment_array', iterfield=['in_array'])
2834

2935
wf.connect(f1, 'random_array', f2, 'in_array')
36+
37+
f3 = pe.Node(
38+
utility.Function(function=concat_sort),
39+
name="concat_sort")
40+
41+
wf.connect(f2, 'out', f3, 'in_arrays')
3042
wf.run()
3143

3244

0 commit comments

Comments
 (0)