@@ -227,14 +227,12 @@ class TestName(nib.CommandLine):
227
227
teardown_file (tmpd )
228
228
229
229
230
- def test_cycle_namesource ():
230
+ def test_cycle_namesource1 ():
231
231
tmp_infile = setup_file ()
232
232
tmpd , nme , ext = split_filename (tmp_infile )
233
233
pwd = os .getcwd ()
234
234
os .chdir (tmpd )
235
235
236
- from unittest import TestCase
237
-
238
236
class spec3 (nib .CommandLineInputSpec ):
239
237
moo = nib .File (name_source = ['doo' ], hash_files = False , argstr = "%s" ,
240
238
position = 1 , name_template = '%s_mootpl' )
@@ -247,19 +245,51 @@ class TestCycle(nib.CommandLine):
247
245
_cmd = "mycommand"
248
246
input_spec = spec3
249
247
250
- def get_cmd (self ):
251
- return self .cmdline
252
-
253
248
# Check that an exception is raised
254
249
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
256
278
257
279
# Check that loop can be broken by setting one of the inputs
258
280
to1 = TestCycle ()
259
281
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
261
291
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
263
293
yield assert_true , '%s_generated_mootpl' % nme in res
264
294
265
295
os .chdir (pwd )
0 commit comments