Skip to content

Commit 41233f8

Browse files
committed
changing the new test mapnode_iterfield_check, so its more general
1 parent bec5bc9 commit 41233f8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

nipype/pipeline/engine/tests/test_engine.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,18 +457,20 @@ def test_mapnode_iterfield_check():
457457

458458

459459
@pytest.mark.parametrize("x_inp, f_exp", [
460-
(3, [9]), ([2, 3], [4, 9]), ((2,3), [4,9]), (range(3), [0, 1, 4])
460+
(3, [6]), ([2, 3], [4, 6]), ((2, 3), [4, 6]),
461+
(range(3), [0, 2, 4]),
462+
("Str", ["StrStr"]), (["Str1", "Str2"], ["Str1Str1", "Str2Str2"])
461463
])
462464
def test_mapnode_iterfield_type(x_inp, f_exp):
463465
from nipype import MapNode, Function
464-
def square_func(x):
465-
return x ** 2
466-
square = Function(["x"], ["f_x"], square_func)
466+
def double_func(x):
467+
return 2 * x
468+
double = Function(["x"], ["f_x"], double_func)
467469

468-
square_node = MapNode(square, name="square", iterfield=["x"])
469-
square_node.inputs.x = x_inp
470+
double_node = MapNode(double, name="double", iterfield=["x"])
471+
double_node.inputs.x = x_inp
470472

471-
res = square_node.run()
473+
res = double_node.run()
472474
assert res.outputs.f_x == f_exp
473475

474476

0 commit comments

Comments
 (0)