|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- |
| 3 | +# vi: set ft=python sts=4 ts=4 sw=4 et: |
| 4 | +"""Tests for the engine workflows module |
| 5 | +""" |
| 6 | +import pytest |
| 7 | + |
| 8 | +from ... import engine as pe |
| 9 | +from ....interfaces import utility as niu |
| 10 | + |
| 11 | + |
| 12 | +def test_duplicate_node_check(): |
| 13 | + |
| 14 | + wf = pe.Workflow(name="testidentity") |
| 15 | + |
| 16 | + original_list = [0,1,2,3,4,5,6,7,8,9] |
| 17 | + |
| 18 | + selector1 = pe.Node(niu.Select(), name="selector1") |
| 19 | + selector1.inputs.index = original_list[:-1] |
| 20 | + selector1.inputs.inlist = original_list |
| 21 | + selector2 = pe.Node(niu.Select(), name="selector2") |
| 22 | + selector2.inputs.index = original_list[:-2] |
| 23 | + selector3 = pe.Node(niu.Select(), name="selector3") |
| 24 | + selector3.inputs.index = original_list[:-3] |
| 25 | + selector4 = pe.Node(niu.Select(), name="selector3") |
| 26 | + selector4.inputs.index = original_list[:-4] |
| 27 | + |
| 28 | + wf_connections = [ |
| 29 | + (selector1, selector2, [("out","inlist")]), |
| 30 | + (selector2, selector3, [("out","inlist")]), |
| 31 | + (selector3, selector4, [("out","inlist")]), |
| 32 | + ] |
| 33 | + |
| 34 | + with pytest.raises(IOError) as excinfo: |
| 35 | + wf.connect(wf_connections) |
| 36 | + assert 'Duplicate node name "selector3" found.' == str(excinfo.value) |
0 commit comments