Skip to content

Commit 5628919

Browse files
committed
Added a test for SPM bool conversion.
1 parent 2c42ff4 commit 5628919

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

nipype/interfaces/spm/tests/test_base.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import nipype.interfaces.spm.base as spm
1212
from nipype.interfaces.spm import no_spm
1313
import nipype.interfaces.matlab as mlab
14+
from nipype.interfaces.spm.base import SPMCommandInputSpec
15+
from nipype.interfaces.base import traits
1416

1517
try:
1618
matlab_cmd = os.environ['MATLABCMD']
@@ -121,7 +123,19 @@ class TestClass(spm.SPMCommand):
121123
out = dc._generate_job(prefix='test', contents=contents)
122124
yield assert_equal, out, 'test.onsets = {...\n[1, 2, 3, 4];...\n};\n'
123125

124-
126+
def test_bool():
127+
class TestClassInputSpec(SPMCommandInputSpec):
128+
test_in = include_intercept = traits.Bool(field='testfield')
129+
130+
class TestClass(spm.SPMCommand):
131+
input_spec = TestClassInputSpec
132+
_jobtype = 'jobtype'
133+
_jobname = 'jobname'
134+
dc = TestClass() # dc = derived_class
135+
dc.inputs.test_in = True
136+
out = dc._make_matlab_command(dc._parse_inputs())
137+
yield assert_equal, out.find('jobs{1}.jobtype{1}.jobname{1}.testfield = 1;') > 0, 1
138+
125139
def test_make_matlab_command():
126140
class TestClass(spm.SPMCommand):
127141
_jobtype = 'jobtype'

0 commit comments

Comments
 (0)