Skip to content

Commit 1f990d9

Browse files
committed
enh: add test from #2431
1 parent 4c81184 commit 1f990d9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

nipype/pipeline/engine/tests/test_base.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import pytest
77
from ..base import EngineBase
88
from ....interfaces import base as nib
9+
from ....interfaces import utility as niu
10+
from ... import engine as pe
911

1012

1113
class InputSpec(nib.TraitedSpec):
@@ -64,3 +66,24 @@ def test_clone():
6466

6567
with pytest.raises(ValueError):
6668
base.clone('nodename')
69+
70+
def test_clone_node_iterables(tmpdir):
71+
tmpdir.chdir()
72+
73+
def addstr(string):
74+
return ('%s+2' % string )
75+
76+
subject_list = ['sub-001', 'sub-002']
77+
inputnode = pe.Node(niu.IdentityInterface(fields = ['subject']),
78+
name = 'inputnode')
79+
inputnode.iterables = [('subject', subject_list)]
80+
81+
node_1 = pe.Node(niu.Function(input_names='string',
82+
output_names= 'string',
83+
function = addstr),name='node_1')
84+
node_2 = node_1.clone('node_2')
85+
86+
workflow = pe.Workflow(name='iter_clone_wf')
87+
workflow.connect([(inputnode, node_1, [('subject','string')]),
88+
(node_1, node_2, [('string','string')])])
89+
workflow.run()

0 commit comments

Comments
 (0)