@@ -255,80 +255,117 @@ def _run_interface(self, runtime):
255
255
nib .BaseInterface .input_spec = None
256
256
yield assert_raises , Exception , nib .BaseInterface
257
257
258
- def test_version ():
258
+ def test_input_version ():
259
259
class InputSpec (nib .TraitedSpec ):
260
- foo = nib .traits .Int (desc = 'a random int' , min_ver = 0.9 )
260
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = ' 0.9' )
261
261
class DerivedInterface1 (nib .BaseInterface ):
262
262
input_spec = InputSpec
263
263
obj = DerivedInterface1 ()
264
264
not_raised = True
265
265
try :
266
- obj ._check_input_version_requirements ( )
266
+ obj ._check_version_requirements ( obj . inputs )
267
267
except :
268
268
not_raised = False
269
269
yield assert_true , not_raised
270
270
config .set ('execution' , 'stop_on_unknown_version' , True )
271
271
try :
272
- obj ._check_input_version_requirements ( )
272
+ obj ._check_version_requirements ( obj . inputs )
273
273
except :
274
274
not_raised = False
275
275
yield assert_false , not_raised
276
276
config .set_default_config ()
277
277
class InputSpec (nib .TraitedSpec ):
278
- foo = nib .traits .Int (desc = 'a random int' , min_ver = 0.9 )
278
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = ' 0.9' )
279
279
class DerivedInterface1 (nib .BaseInterface ):
280
280
input_spec = InputSpec
281
- _version = 0.8
281
+ _version = ' 0.8'
282
282
obj = DerivedInterface1 ()
283
283
obj .inputs .foo = 1
284
- yield assert_raises , Exception , obj ._check_input_version_requirements
284
+ yield assert_raises , Exception , obj ._check_version_requirements
285
285
class InputSpec (nib .TraitedSpec ):
286
- foo = nib .traits .Int (desc = 'a random int' , min_ver = 0.9 )
286
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = ' 0.9' )
287
287
class DerivedInterface1 (nib .BaseInterface ):
288
288
input_spec = InputSpec
289
- _version = 0.10
289
+ _version = ' 0.10'
290
290
obj = DerivedInterface1 ()
291
291
not_raised = True
292
292
try :
293
- obj ._check_input_version_requirements ( )
293
+ obj ._check_version_requirements ( obj . inputs )
294
294
except :
295
295
not_raised = False
296
296
yield assert_true , not_raised
297
297
class InputSpec (nib .TraitedSpec ):
298
- foo = nib .traits .Int (desc = 'a random int' , min_ver = 0.9 )
298
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = ' 0.9' )
299
299
class DerivedInterface1 (nib .BaseInterface ):
300
300
input_spec = InputSpec
301
- _version = 0.9
301
+ _version = ' 0.9'
302
302
obj = DerivedInterface1 ()
303
303
obj .inputs .foo = 1
304
304
not_raised = True
305
305
try :
306
- obj ._check_input_version_requirements ( )
306
+ obj ._check_version_requirements ( obj . inputs )
307
307
except :
308
308
not_raised = False
309
309
yield assert_true , not_raised
310
310
class InputSpec (nib .TraitedSpec ):
311
- foo = nib .traits .Int (desc = 'a random int' , max_ver = 0.7 )
311
+ foo = nib .traits .Int (desc = 'a random int' , max_ver = ' 0.7' )
312
312
class DerivedInterface2 (nib .BaseInterface ):
313
313
input_spec = InputSpec
314
- _version = 0.8
314
+ _version = ' 0.8'
315
315
obj = DerivedInterface2 ()
316
316
obj .inputs .foo = 1
317
- yield assert_raises , Exception , obj ._check_input_version_requirements
317
+ yield assert_raises , Exception , obj ._check_version_requirements
318
318
class InputSpec (nib .TraitedSpec ):
319
- foo = nib .traits .Int (desc = 'a random int' , max_ver = 0.9 )
319
+ foo = nib .traits .Int (desc = 'a random int' , max_ver = ' 0.9' )
320
320
class DerivedInterface1 (nib .BaseInterface ):
321
321
input_spec = InputSpec
322
- _version = 0.9
322
+ _version = ' 0.9'
323
323
obj = DerivedInterface1 ()
324
324
obj .inputs .foo = 1
325
325
not_raised = True
326
326
try :
327
- obj ._check_input_version_requirements ( )
327
+ obj ._check_version_requirements ( obj . inputs )
328
328
except :
329
329
not_raised = False
330
330
yield assert_true , not_raised
331
331
332
+ def test_output_version ():
333
+ class InputSpec (nib .TraitedSpec ):
334
+ foo = nib .traits .Int (desc = 'a random int' )
335
+ class OutputSpec (nib .TraitedSpec ):
336
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = '0.9' )
337
+ class DerivedInterface1 (nib .BaseInterface ):
338
+ input_spec = InputSpec
339
+ output_spec = OutputSpec
340
+ _version = '0.10'
341
+ obj = DerivedInterface1 ()
342
+ yield assert_equal , obj ._check_version_requirements (obj ._outputs ()), []
343
+
344
+ class InputSpec (nib .TraitedSpec ):
345
+ foo = nib .traits .Int (desc = 'a random int' )
346
+ class OutputSpec (nib .TraitedSpec ):
347
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = '0.11' )
348
+ class DerivedInterface1 (nib .BaseInterface ):
349
+ input_spec = InputSpec
350
+ output_spec = OutputSpec
351
+ _version = '0.10'
352
+ obj = DerivedInterface1 ()
353
+ yield assert_equal , obj ._check_version_requirements (obj ._outputs ()), ['foo' ]
354
+ class InputSpec (nib .TraitedSpec ):
355
+ foo = nib .traits .Int (desc = 'a random int' )
356
+ class OutputSpec (nib .TraitedSpec ):
357
+ foo = nib .traits .Int (desc = 'a random int' , min_ver = '0.11' )
358
+ class DerivedInterface1 (nib .BaseInterface ):
359
+ input_spec = InputSpec
360
+ output_spec = OutputSpec
361
+ _version = '0.10'
362
+ def _run_interface (self , runtime ):
363
+ return runtime
364
+ def _list_outputs (self ):
365
+ return {'foo' : 1 }
366
+ obj = DerivedInterface1 ()
367
+ yield assert_raises , KeyError , obj .run
368
+
332
369
def test_Commandline ():
333
370
yield assert_raises , Exception , nib .CommandLine
334
371
ci = nib .CommandLine (command = 'which' )
0 commit comments