@slow_test
def test_apply_function_verbose():
 n_chan = 2
 n_times = 3
 ch_names = [str(ii) for ii in range(n_chan)]
 raw = RawArray(np.zeros((n_chan, n_times)), create_info(ch_names, 1.0, 'mag'))
 assert_raises(TypeError, raw.apply_function, bad_1)
 assert_raises(ValueError, raw.apply_function, bad_2)
 assert_raises(TypeError, raw.apply_function, bad_1, n_jobs=2)
 assert_raises(ValueError, raw.apply_function, bad_2, n_jobs=2)
 with catch_logging() as sio:
  out = raw.apply_function(printer, verbose=False)
  assert_equal(len(sio.getvalue()), 0)
  assert_true((out is raw))
  raw.apply_function(printer, verbose=True)
  assert_equal(sio.getvalue().count('\n'), n_chan)

@ slow_test def test_apply_function_verbose ( ) : n_chan = 2 n_times = 3 ch_names = [ str ( ii ) for ii in range ( n_chan ) ] raw = RawArray ( np . zeros ( ( n_chan , n_times ) ) , create_info ( ch_names , 1.0 , 'mag' ) ) assert_raises ( TypeError , raw . apply_function , bad_1 ) assert_raises ( ValueError , raw . apply_function , bad_2 ) assert_raises ( TypeError , raw . apply_function , bad_1 , n_jobs = 2 ) assert_raises ( ValueError , raw . apply_function , bad_2 , n_jobs = 2 ) with catch_logging ( ) as sio : out = raw . apply_function ( printer , verbose = False ) assert_equal ( len ( sio . getvalue ( ) ) , 0 ) assert_true ( ( out is raw ) ) raw . apply_function ( printer , verbose = True ) assert_equal ( sio . getvalue ( ) . count ( '\n' ) , n_chan )
test apply function verbosity .