MCPcopy
hub / github.com/mne-tools/mne-python / test_verbose_arg

Function test_verbose_arg

mne/decoding/tests/test_search_light.py:299–316  ·  view source on GitHub ↗

Test controlling output with the ``verbose`` argument.

(capsys, n_jobs, verbose)

Source from the content-addressed store, hash-verified

297 "n_jobs, verbose", [(1, False), (2, False), (1, True), (2, "info")]
298)
299def test_verbose_arg(capsys, n_jobs, verbose):
300 """Test controlling output with the ``verbose`` argument."""
301 X, y = make_data()
302 clf = SVC()
303
304 # shows progress bar and prints other messages to the console
305 with use_log_level(True):
306 for estimator_object in [SlidingEstimator, GeneralizingEstimator]:
307 estimator = estimator_object(clf, n_jobs=n_jobs, verbose=verbose)
308 estimator = estimator.fit(X, y)
309 estimator.score(X, y)
310 estimator.predict(X)
311
312 stdout, stderr = capsys.readouterr()
313 if isinstance(verbose, bool) and not verbose:
314 assert all(channel == "" for channel in (stdout, stderr))
315 else:
316 assert any(len(channel) > 0 for channel in (stdout, stderr))
317
318
319def test_cross_val_predict():

Callers

nothing calls this directly

Calls 5

use_log_levelClass · 0.90
make_dataFunction · 0.85
fitMethod · 0.45
scoreMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected