def ipexec_validate(fname, expected_out, expected_err='', options=None, commands=()):
 import nose.tools as nt
 (out, err) = ipexec(fname, options, commands)
 if err:
  if expected_err:
   nt.assert_equal('\n'.join(err.strip().splitlines()), '\n'.join(expected_err.strip().splitlines()))
  else:
   raise ValueError(('Running file %r produced error: %r' % (fname, err)))
 nt.assert_equal('\n'.join(out.strip().splitlines()), '\n'.join(expected_out.strip().splitlines()))

def ipexec_validate ( fname , expected_out , expected_err = '' , options = None , commands = ( ) ) : import nose . tools as nt ( out , err ) = ipexec ( fname , options , commands ) if err : if expected_err : nt . assert_equal ( '\n' . join ( err . strip ( ) . splitlines ( ) ) , '\n' . join ( expected_err . strip ( ) . splitlines ( ) ) ) else : raise ValueError ( ( 'Running file %r produced error: %r' % ( fname , err ) ) ) nt . assert_equal ( '\n' . join ( out . strip ( ) . splitlines ( ) ) , '\n' . join ( expected_out . strip ( ) . splitlines ( ) ) )
utility to call ipython filename and validate output/error .