MCPcopy Index your code
hub / github.com/mne-tools/mne-python / test_apply_function_verbose

Function test_apply_function_verbose

mne/io/tests/test_apply_function.py:35–64  ·  view source on GitHub ↗

Test apply function verbosity.

()

Source from the content-addressed store, hash-verified

33
34@pytest.mark.slowtest
35def test_apply_function_verbose():
36 """Test apply function verbosity."""
37 n_chan = 2
38 n_times = 3
39 ch_names = [str(ii) for ii in range(n_chan)]
40 raw = RawArray(np.zeros((n_chan, n_times)), create_info(ch_names, 1.0, "mag"))
41 # test return types in both code paths (parallel / 1 job)
42 with pytest.raises(TypeError, match="Return value must be an ndarray"):
43 raw.apply_function(bad_1)
44 with pytest.raises(ValueError, match="Return data must have shape"):
45 raw.apply_function(bad_2)
46 with pytest.raises(TypeError, match="Return value must be an ndarray"):
47 raw.apply_function(bad_1, n_jobs=2)
48 with pytest.raises(ValueError, match="Return data must have shape"):
49 raw.apply_function(bad_2, n_jobs=2)
50
51 # test return type when `channel_wise=False`
52 raw.apply_function(printer, channel_wise=False)
53 with pytest.raises(TypeError, match="Return value must be an ndarray"):
54 raw.apply_function(bad_1, channel_wise=False)
55 with pytest.raises(ValueError, match="Return data must have shape"):
56 raw.apply_function(bad_3, channel_wise=False)
57
58 # check our arguments
59 with catch_logging() as sio:
60 out = raw.apply_function(printer, verbose=False)
61 assert len(sio.getvalue(close=False)) == 0
62 assert out is raw
63 raw.apply_function(printer, verbose=True)
64 assert sio.getvalue().count("\n") == n_chan
65
66
67def test_apply_function_ch_access():

Callers

nothing calls this directly

Calls 6

RawArrayClass · 0.90
create_infoFunction · 0.90
catch_loggingClass · 0.90
getvalueMethod · 0.80
countMethod · 0.80
apply_functionMethod · 0.45

Tested by

no test coverage detected