Skip to content

Commit 57c1fb6

Browse files
committed
TEST: Add nested iterables test
1 parent 75451e4 commit 57c1fb6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

nipype/pipeline/engine/tests/test_join.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,3 +627,35 @@ def sq(x):
627627
joinfield=['in1'])
628628
wf.connect(square, 'out', square_join, "in1")
629629
wf.run()
630+
631+
632+
def test_join_nestediters(tmpdir):
633+
tmpdir.chdir()
634+
635+
def exponent(x, p):
636+
return x ** p
637+
638+
wf = pe.Workflow('wf', base_dir=tmpdir.strpath)
639+
640+
xs = pe.Node(IdentityInterface(['x']),
641+
iterables=[('x', [1, 2])],
642+
name='xs')
643+
ps = pe.Node(IdentityInterface(['p']),
644+
iterables=[('p', [3, 4])],
645+
name='ps')
646+
exp = pe.Node(Function(function=exponent), name='exp')
647+
exp_joinx = pe.JoinNode(Merge(1, ravel_inputs=True),
648+
name='exp_joinx',
649+
joinsource='xs',
650+
joinfield=['in1'])
651+
exp_joinp = pe.JoinNode(Merge(1, ravel_inputs=True),
652+
name='exp_joinp',
653+
joinsource='ps',
654+
joinfield=['in1'])
655+
wf.connect([
656+
(xs, exp, [('x', 'x')]),
657+
(ps, exp, [('p', 'p')]),
658+
(exp, exp_joinx, [('out', 'in1')]),
659+
(exp_joinx, exp_joinp, [('out', 'in1')])])
660+
661+
wf.run()

0 commit comments

Comments
 (0)