15
15
import numpy as np
16
16
import os
17
17
18
+
19
+
20
+
21
+
18
22
def mock_node_factory (* args , ** kwargs ):
19
23
''' return mocks for all the nodes except compcor and compcor's neighbors'''
20
24
mock = MagicMock ()
25
+ if 'interface' in kwargs .keys ():
26
+ mock = mock .create_autospec (kwargs ['interface' ], instance = True )
21
27
if 'name' in kwargs .keys ():
22
28
name = kwargs ['name' ]
23
29
if name == 'compcor' :
@@ -28,21 +34,20 @@ def mock_node_factory(*args, **kwargs):
28
34
return Node (IdentityInterface (fields = ['out_file' , 'lowpass_sigma' ,
29
35
'num_noise_components' ,
30
36
'func' , 'highpass_sigma' ]),
31
- name = 'fake' + name )
37
+ name = name )
32
38
if name in ('remove_noise' ):
33
39
# node that takes output from compcor
34
40
return Node (IdentityInterface (fields = ['design_file' , 'out_file' ]),
35
41
name = name )
36
42
mock .name = kwargs ['name' ]
37
- if 'interface' in kwargs .keys ():
38
- mock = mock .create_autospec (kwargs ['interface' ], instance = True )
39
43
mock .iterables = None
40
44
return mock
41
45
42
46
class TestResting (unittest .TestCase ):
43
47
44
48
in_filenames = {
45
49
'in_file' : 'rsfmrifunc.nii' ,
50
+ 'noise_mask_file' : 'rsfmrimask.nii'
46
51
}
47
52
48
53
out_filenames = {
@@ -64,6 +69,8 @@ def test_create_resting_preproc(self, mock_Node, mock_realign_wf, nothing):
64
69
# setup
65
70
# run
66
71
wf = create_resting_preproc ()
72
+ wf .inputs .inputspec .num_noise_components = 6
73
+ wf .get_node ('threshold' ).inputs .out_file = self .in_filenames ['noise_mask_file' ]
67
74
wf .run ()
68
75
69
76
# assert
0 commit comments