@@ -63,7 +63,6 @@ def increment_array(in_array):
63
63
f2 = pe .MapNode (utility .Function (input_names = ['in_array' ], output_names = ['out_array' ], function = increment_array ), name = 'increment_array' , iterfield = ['in_array' ])
64
64
65
65
wf .connect (f1 , 'random_array' , f2 , 'in_array' )
66
-
67
66
wf .run ()
68
67
69
68
# Clean up
@@ -167,3 +166,57 @@ def test_csvReader():
167
166
yield assert_equal , out .outputs .column_1 , ['hello' , 'world' , 'goodbye' ]
168
167
yield assert_equal , out .outputs .column_2 , ['300.1' , '5' , '0.3' ]
169
168
os .unlink (name )
169
+
170
+
171
+ def test_aux_connect_function ():
172
+ """ This tests excution nodes with multiple inputs and auxiliary
173
+ function inside the Workflow connect function.
174
+ """
175
+ tempdir = os .path .realpath (mkdtemp ())
176
+ origdir = os .getcwd ()
177
+ os .chdir (tempdir )
178
+
179
+ wf = pe .Workflow (name = "test_workflow" )
180
+
181
+ def _gen_tuple (size ):
182
+ return [1 , ] * size
183
+
184
+ def _sum_and_sub_mul (a , b , c ):
185
+ return (a + b )* c , (a - b )* c
186
+
187
+ def _inc (x ):
188
+ return x + 1
189
+
190
+ params = pe .Node (utility .IdentityInterface (fields = ['size' , 'num' ]), name = 'params' )
191
+ params .inputs .num = 42
192
+ params .inputs .size = 1
193
+
194
+ gen_tuple = pe .Node (utility .Function (input_names = ['size' ],
195
+ output_names = ['tuple' ],
196
+ function = _gen_tuple ),
197
+ name = 'gen_tuple' )
198
+
199
+ ssm = pe .Node (utility .Function (input_names = ['a' , 'b' , 'c' ],
200
+ output_names = ['sum' , 'sub' ],
201
+ function = _sum_and_sub_mul ),
202
+ name = 'sum_and_sub_mul' )
203
+
204
+ split = pe .Node (utility .Split (splits = [1 , 1 ],
205
+ squeeze = True ),
206
+ name = 'split' )
207
+
208
+
209
+ wf .connect ([
210
+ (params , gen_tuple , [(("size" , _inc ), "size" )]),
211
+ (params , ssm , [(("num" , _inc ), "c" )]),
212
+ (gen_tuple , split , [("tuple" , "inlist" )]),
213
+ (split , ssm , [(("out1" , _inc ), "a" ),
214
+ ("out2" , "b" ),
215
+ ]),
216
+ ])
217
+
218
+ wf .run ()
219
+
220
+ # Clean up
221
+ os .chdir (origdir )
222
+ shutil .rmtree (tempdir )
0 commit comments