@@ -227,14 +227,12 @@ class TestName(nib.CommandLine):
227227 teardown_file (tmpd )
228228
229229
230- def test_cycle_namesource ():
230+ def test_cycle_namesource1 ():
231231 tmp_infile = setup_file ()
232232 tmpd , nme , ext = split_filename (tmp_infile )
233233 pwd = os .getcwd ()
234234 os .chdir (tmpd )
235235
236- from unittest import TestCase
237-
238236 class spec3 (nib .CommandLineInputSpec ):
239237 moo = nib .File (name_source = ['doo' ], hash_files = False , argstr = "%s" ,
240238 position = 1 , name_template = '%s_mootpl' )
@@ -247,19 +245,51 @@ class TestCycle(nib.CommandLine):
247245 _cmd = "mycommand"
248246 input_spec = spec3
249247
250- def get_cmd (self ):
251- return self .cmdline
252-
253248 # Check that an exception is raised
254249 to0 = TestCycle ()
255- yield assert_raises , nib .NipypeInterfaceError , to0 .get_cmd
250+ not_raised = True
251+ try :
252+ to0 .cmdline
253+ except nib .NipypeInterfaceError :
254+ not_raised = False
255+ yield assert_false , not_raised
256+
257+ os .chdir (pwd )
258+ teardown_file (tmpd )
259+
260+ def test_cycle_namesource2 ():
261+ tmp_infile = setup_file ()
262+ tmpd , nme , ext = split_filename (tmp_infile )
263+ pwd = os .getcwd ()
264+ os .chdir (tmpd )
265+
266+
267+ class spec3 (nib .CommandLineInputSpec ):
268+ moo = nib .File (name_source = ['doo' ], hash_files = False , argstr = "%s" ,
269+ position = 1 , name_template = '%s_mootpl' )
270+ poo = nib .File (name_source = ['moo' ], hash_files = False ,
271+ argstr = "%s" , position = 2 )
272+ doo = nib .File (name_source = ['poo' ], hash_files = False ,
273+ argstr = "%s" , position = 3 )
274+
275+ class TestCycle (nib .CommandLine ):
276+ _cmd = "mycommand"
277+ input_spec = spec3
256278
257279 # Check that loop can be broken by setting one of the inputs
258280 to1 = TestCycle ()
259281 to1 .inputs .poo = tmp_infile
260- res = to1 .cmdline
282+
283+ not_raised = True
284+ try :
285+ res = to1 .cmdline
286+ except nib .NipypeInterfaceError :
287+ not_raised = False
288+ print res
289+
290+ yield assert_true , not_raised
261291 yield assert_true , '%s' % tmp_infile in res
262- yield assert_true , '%s_generated ' % nme in res
292+ yield assert_true , '%s_generated' % nme in res
263293 yield assert_true , '%s_generated_mootpl' % nme in res
264294
265295 os .chdir (pwd )
0 commit comments