def test_io_subclass():
 from nipype.interfaces.io import IOBase
 from nipype.interfaces.base import DynamicTraitedSpec
 class TestKV(IOBase, ):
  _always_run = True
  output_spec = DynamicTraitedSpec
  def _list_outputs(self):
   outputs = {}
   outputs[u'test'] = 1
   outputs[u'foo'] = u'bar'
   return outputs
 wf = pe.Workflow(u'testkv')
 def testx2(test):
  return (test * 2)
 kvnode = pe.Node(TestKV(), name=u'testkv')
 from nipype.interfaces.utility import Function
 func = pe.Node(Function(input_names=[u'test'], output_names=[u'test2'], function=testx2), name=u'func')
 exception_not_raised = True
 try:
  wf.connect(kvnode, u'test', func, u'test')
 except Exception as e:
  if (u'Module testkv has no output called test' in e):
   exception_not_raised = False
 assert exception_not_raised

def test_io_subclass ( ) : from nipype . interfaces . io import IOBase from nipype . interfaces . base import DynamicTraitedSpec class TestKV ( IOBase , ) : _always_run = True output_spec = DynamicTraitedSpec def _list_outputs ( self ) : outputs = { } outputs [ u'test' ] = 1 outputs [ u'foo' ] = u'bar' return outputs wf = pe . Workflow ( u'testkv' ) def testx2 ( test ) : return ( test * 2 ) kvnode = pe . Node ( TestKV ( ) , name = u'testkv' ) from nipype . interfaces . utility import Function func = pe . Node ( Function ( input_names = [ u'test' ] , output_names = [ u'test2' ] , function = testx2 ) , name = u'func' ) exception_not_raised = True try : wf . connect ( kvnode , u'test' , func , u'test' ) except Exception as e : if ( u'Module testkv has no output called test' in e ) : exception_not_raised = False assert exception_not_raised
ensure any io subclass allows dynamic traits .