Skip to content

Commit 6f5939f

Browse files
committed
checking more specific exceptions
1 parent cbe93e7 commit 6f5939f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

nipype/pipeline/engine/tests/test_engine.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _list_outputs(self):
4343

4444

4545
def test_init():
46-
with pytest.raises(Exception): pe.Workflow()
46+
with pytest.raises(TypeError): pe.Workflow()
4747
pipe = pe.Workflow(name='pipe')
4848
assert type(pipe._graph) == nx.DiGraph
4949

@@ -326,11 +326,16 @@ def test_doubleconnect():
326326
flow1 = pe.Workflow(name='test')
327327
flow1.connect(a, 'a', b, 'a')
328328
x = lambda: flow1.connect(a, 'b', b, 'a')
329-
with pytest.raises(Exception): x()
329+
with pytest.raises(Exception) as excinfo:
330+
x()
331+
assert "Trying to connect" in str(excinfo.value)
332+
330333
c = pe.Node(IdentityInterface(fields=['a', 'b']), name='c')
331334
flow1 = pe.Workflow(name='test2')
332335
x = lambda: flow1.connect([(a, c, [('b', 'b')]), (b, c, [('a', 'b')])])
333-
with pytest.raises(Exception): x()
336+
with pytest.raises(Exception) as excinfo:
337+
x()
338+
assert "Trying to connect" in str(excinfo.value)
334339

335340

336341
'''
@@ -476,8 +481,9 @@ def func1(in1):
476481
name='n1')
477482
n2.inputs.in1 = [[1, [2]], 3, [4, 5]]
478483

479-
with pytest.raises(Exception): n2.run()
480-
484+
with pytest.raises(Exception) as excinfo:
485+
n2.run()
486+
assert "can only concatenate list" in str(excinfo.value)
481487

482488

483489
def test_node_hash(tmpdir):

0 commit comments

Comments
 (0)