This is an automated email from the git hooks/post-receive script. yoh pushed a commit to annotated tag v0.1 in repository python-mne.
commit 234b9d943743072308e981bd2ba2e457f1d1881a Author: Alexandre Gramfort <[email protected]> Date: Tue Sep 13 17:26:19 2011 -0400 ENH : using nose.tools.assert_true instead of assert --- mne/artifacts/tests/test_ecg.py | 3 ++- mne/artifacts/tests/test_eog.py | 3 ++- mne/fiff/tests/test_proj.py | 9 +++++---- mne/fiff/tests/test_raw.py | 5 +++-- mne/minimum_norm/tests/test_inverse.py | 14 +++++++------- mne/minimum_norm/tests/test_time_frequency.py | 5 +++-- mne/stats/tests/test_cluster_level.py | 5 +++-- mne/tests/test_cov.py | 17 +++++++++-------- mne/tests/test_epochs.py | 9 +++++---- mne/tests/test_label.py | 5 +++-- mne/tests/test_misc.py | 3 ++- mne/tests/test_source_estimate.py | 3 ++- mne/tests/test_source_space.py | 17 +++++++++-------- mne/time_frequency/tests/test_psd.py | 7 ++++--- mne/time_frequency/tests/test_tfr.py | 19 ++++++++++--------- 15 files changed, 69 insertions(+), 55 deletions(-) diff --git a/mne/artifacts/tests/test_ecg.py b/mne/artifacts/tests/test_ecg.py index e7da1c2..ad37827 100644 --- a/mne/artifacts/tests/test_ecg.py +++ b/mne/artifacts/tests/test_ecg.py @@ -1,5 +1,6 @@ import os.path as op +from nose.tools import assert_true from numpy.testing import assert_array_almost_equal from ...fiff import Raw @@ -18,4 +19,4 @@ def test_find_ecg(): n_events = len(events) _, times = raw[0, :] average_pulse = 60.0 * (times[-1] - times[0]) / n_events - assert 60 < average_pulse < 65 + assert_true(60 < average_pulse < 65) diff --git a/mne/artifacts/tests/test_eog.py b/mne/artifacts/tests/test_eog.py index 865e8fd..d93e541 100644 --- a/mne/artifacts/tests/test_eog.py +++ b/mne/artifacts/tests/test_eog.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true from ...fiff import Raw from ..eog import find_eog_events @@ -14,4 +15,4 @@ def test_find_eog(): raw = Raw(raw_fname) events = find_eog_events(raw) n_events = len(events) - assert n_events == 4 + assert_true(n_events == 4) diff --git a/mne/fiff/tests/test_proj.py b/mne/fiff/tests/test_proj.py index 53d8deb..032fc27 100644 --- a/mne/fiff/tests/test_proj.py +++ b/mne/fiff/tests/test_proj.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true import numpy as np from numpy.testing import assert_array_almost_equal @@ -32,8 +33,8 @@ def test_compute_spatial_vectors(): projs2 = read_proj(fid, tree) for k, (p1, p2) in enumerate(zip(projs, projs2)): - assert p1['desc'] == p2['desc'] - assert p1['data']['col_names'] == p2['data']['col_names'] + assert_true(p1['desc'] == p2['desc']) + assert_true(p1['data']['col_names'] == p2['data']['col_names']) # compare with sign invariance p1_data = p1['data']['data'] * np.sign(p1['data']['data'][0, 0]) p2_data = p2['data']['data'] * np.sign(p2['data']['data'][0, 0]) @@ -48,8 +49,8 @@ def test_compute_spatial_vectors(): # test that you can compute the projection matrix proj, nproj, U = make_projector(projs, epochs.ch_names, bads=[]) - assert nproj == 2 - assert U.shape[1] == 2 + assert_true(nproj == 2) + assert_true(U.shape[1] == 2) # test that you can save them epochs.info['projs'] += projs diff --git a/mne/fiff/tests/test_raw.py b/mne/fiff/tests/test_raw.py index 42fcd7b..8952f70 100644 --- a/mne/fiff/tests/test_raw.py +++ b/mne/fiff/tests/test_raw.py @@ -1,5 +1,6 @@ import os.path as op +from nose.tools import assert_true from numpy.testing import assert_array_almost_equal from .. import Raw, pick_types, pick_channels @@ -39,13 +40,13 @@ def test_io_raw(): sel = pick_channels(raw2.ch_names, meg_ch_names) data2, times2 = raw2[sel, :] - assert times2.max() <= 3 + assert_true(times2.max() <= 3) # Writing raw.save('raw.fif', picks, tmin=0, tmax=5) if fname == fif_fname: - assert len(raw.info['dig']) == 146 + assert_true(len(raw.info['dig']) == 146) raw2 = Raw('raw.fif') diff --git a/mne/minimum_norm/tests/test_inverse.py b/mne/minimum_norm/tests/test_inverse.py index 07fdc6e..c5545a2 100644 --- a/mne/minimum_norm/tests/test_inverse.py +++ b/mne/minimum_norm/tests/test_inverse.py @@ -1,7 +1,7 @@ import os.path as op - import numpy as np from numpy.testing import assert_array_almost_equal, assert_equal +from nose.tools import assert_true from ...datasets import sample from ...label import read_label @@ -46,8 +46,8 @@ def test_inverse_operator(): evoked = fiff.Evoked(fname_data, setno=0, baseline=(None, 0)) stc = apply_inverse(evoked, inverse_operator, lambda2, dSPM) - assert np.all(stc.data > 0) - assert np.all(stc.data < 35) + assert_true(np.all(stc.data > 0)) + assert_true(np.all(stc.data < 35)) # Test MNE inverse computation starting from forward operator noise_cov = Covariance(fname_cov) @@ -68,7 +68,7 @@ def test_apply_mne_inverse_raw(): stc = apply_inverse_raw(raw, inverse_operator, lambda2, dSPM=True, label=label, start=0, stop=10, nave=1, pick_normal=False) - assert np.all(stc.data > 0) + assert_true(np.all(stc.data > 0)) def test_apply_mne_inverse_epochs(): @@ -87,7 +87,7 @@ def test_apply_mne_inverse_epochs(): stcs = apply_inverse_epochs(epochs, inverse_operator, lambda2, dSPM, label=label) - assert len(stcs) == 1 - assert np.all(stcs[0].data > 0) - assert np.all(stcs[0].data < 42) + assert_true(len(stcs) == 1) + assert_true(np.all(stcs[0].data > 0)) + assert_true(np.all(stcs[0].data < 42)) diff --git a/mne/minimum_norm/tests/test_time_frequency.py b/mne/minimum_norm/tests/test_time_frequency.py index 3622b90..b5fd78f 100644 --- a/mne/minimum_norm/tests/test_time_frequency.py +++ b/mne/minimum_norm/tests/test_time_frequency.py @@ -2,6 +2,7 @@ import os.path as op import numpy as np from numpy.testing import assert_array_almost_equal, assert_equal +from nose.tools import assert_true from ...datasets import sample from ... import fiff, find_events, Epochs @@ -48,8 +49,8 @@ def test_tfr_with_inverse_operator(): use_fft=False, pca=True) stc = stcs['alpha'] - assert len(stcs) == len(bands.keys()) - assert np.all(stc.data > 0) + assert_true(len(stcs) == len(bands.keys())) + assert_true(np.all(stc.data > 0)) assert_array_almost_equal(stc.times, epochs.times) stcs_no_pca = source_induced_power(epochs, inverse_operator, bands, n_cycles=2, diff --git a/mne/stats/tests/test_cluster_level.py b/mne/stats/tests/test_cluster_level.py index f747325..57df948 100644 --- a/mne/stats/tests/test_cluster_level.py +++ b/mne/stats/tests/test_cluster_level.py @@ -1,5 +1,6 @@ import numpy as np from numpy.testing import assert_equal, assert_array_equal +from nose.tools import assert_true from ..cluster_level import permutation_cluster_test, \ permutation_cluster_1samp_test @@ -66,5 +67,5 @@ def test_cluster_permutation_t_test_with_connectivity(): n_permutations=500, connectivity=connectivity) assert_array_equal(out[0], out_connectivity[0]) for a, b in zip(out_connectivity[1], out[1]): - assert np.sum(out[0][a]) == np.sum(out[0][b]) - assert np.all(a[b]) + assert_true(np.sum(out[0][a]) == np.sum(out[0][b])) + assert_true(np.all(a[b])) diff --git a/mne/tests/test_cov.py b/mne/tests/test_cov.py index 3ec9531..2124f02 100644 --- a/mne/tests/test_cov.py +++ b/mne/tests/test_cov.py @@ -1,5 +1,6 @@ import os.path as op +from nose.tools import assert_true from numpy.testing import assert_array_almost_equal from scipy import linalg @@ -41,10 +42,10 @@ def test_cov_estimation_on_raw_segment(): raw = Raw(raw_fname) cov = compute_raw_data_covariance(raw) cov_mne = Covariance(erm_cov_fname) - assert cov_mne.ch_names == cov.ch_names + assert_true(cov_mne.ch_names == cov.ch_names) print (linalg.norm(cov.data - cov_mne.data, ord='fro') / linalg.norm(cov.data, ord='fro')) - assert (linalg.norm(cov.data - cov_mne.data, ord='fro') + assert_true(linalg.norm(cov.data - cov_mne.data, ord='fro') / linalg.norm(cov.data, ord='fro')) < 1e-6 @@ -63,12 +64,12 @@ def test_cov_estimation_with_triggers(): cov = compute_covariance(epochs, keep_sample_mean=True) cov_mne = Covariance(cov_km_fname) - assert cov_mne.ch_names == cov.ch_names - assert (linalg.norm(cov.data - cov_mne.data, ord='fro') - / linalg.norm(cov.data, ord='fro')) < 0.005 + assert_true(cov_mne.ch_names == cov.ch_names) + assert_true((linalg.norm(cov.data - cov_mne.data, ord='fro') + / linalg.norm(cov.data, ord='fro')) < 0.005) cov = compute_covariance(epochs, keep_sample_mean=False) cov_mne = Covariance(cov_fname) - assert cov_mne.ch_names == cov.ch_names - assert (linalg.norm(cov.data - cov_mne.data, ord='fro') - / linalg.norm(cov.data, ord='fro')) < 0.06 + assert_true(cov_mne.ch_names == cov.ch_names) + assert_true((linalg.norm(cov.data - cov_mne.data, ord='fro') + / linalg.norm(cov.data, ord='fro')) < 0.06) diff --git a/mne/tests/test_epochs.py b/mne/tests/test_epochs.py index 1503d33..5d97441 100644 --- a/mne/tests/test_epochs.py +++ b/mne/tests/test_epochs.py @@ -3,6 +3,7 @@ # License: BSD (3-clause) import os.path as op +from nose.tools import assert_true from numpy.testing import assert_array_equal, assert_array_almost_equal from .. import fiff, Epochs, read_events @@ -36,7 +37,7 @@ def test_read_epochs(): eog=True) epochs.drop_picks(eog_picks) data_no_eog = epochs.get_data() - assert data.shape[1] == (data_no_eog.shape[1] + len(eog_picks)) + assert_true(data.shape[1] == (data_no_eog.shape[1] + len(eog_picks))) def test_reject_epochs(): @@ -51,8 +52,8 @@ def test_reject_epochs(): # Should match # mne_process_raw --raw test_raw.fif --projoff \ # --saveavetag -ave --ave test.ave --filteroff - assert n_events > n_clean_epochs - assert n_clean_epochs == 3 + assert_true(n_events > n_clean_epochs) + assert_true(n_clean_epochs == 3) def test_preload_epochs(): @@ -82,6 +83,6 @@ def test_comparision_with_c(): evoked_data = evoked.data c_evoked_data = c_evoked.data[sel] - assert evoked.nave == c_evoked.nave + assert_true(evoked.nave == c_evoked.nave) assert_array_almost_equal(evoked_data, c_evoked_data, 10) assert_array_almost_equal(evoked.times, c_evoked.times, 12) diff --git a/mne/tests/test_label.py b/mne/tests/test_label.py index b5f6d14..846c999 100644 --- a/mne/tests/test_label.py +++ b/mne/tests/test_label.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true from ..datasets import sample from .. import label_time_courses @@ -16,5 +17,5 @@ def test_label_io_and_time_course_estimates(): values, times, vertices = label_time_courses(label_fname, stc_fname) - assert len(times) == values.shape[1] - assert len(vertices) == values.shape[0] + assert_true(len(times) == values.shape[1]) + assert_true(len(vertices) == values.shape[0]) diff --git a/mne/tests/test_misc.py b/mne/tests/test_misc.py index f7fbddc..1b94394 100644 --- a/mne/tests/test_misc.py +++ b/mne/tests/test_misc.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true from ..misc import parse_config @@ -9,4 +10,4 @@ def test_parse_ave(): """Test parsing of .ave file """ conditions = parse_config(ave_fname) - assert len(conditions) == 4 + assert_true(len(conditions) == 4) diff --git a/mne/tests/test_source_estimate.py b/mne/tests/test_source_estimate.py index 63f2319..46e7623 100644 --- a/mne/tests/test_source_estimate.py +++ b/mne/tests/test_source_estimate.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_equal @@ -44,7 +45,7 @@ def test_morph_data(): mean_from = stc_from.data.mean(axis=0) mean_to = stc_to.data.mean(axis=0) - assert np.corrcoef(mean_to, mean_from).min() > 0.99 + assert_true(np.corrcoef(mean_to, mean_from).min() > 0.99) def test_spatio_temporal_tris_connectivity(): diff --git a/mne/tests/test_source_space.py b/mne/tests/test_source_space.py index 76f81d9..1213352 100644 --- a/mne/tests/test_source_space.py +++ b/mne/tests/test_source_space.py @@ -1,4 +1,5 @@ import os.path as op +from nose.tools import assert_true from ..datasets import sample from .. import read_source_spaces @@ -21,11 +22,11 @@ def test_read_source_spaces(): rh_points = src[1]['rr'] rh_faces = src[1]['tris'] rh_use_faces = src[1]['use_tris'] - assert lh_faces.min() == 0 - assert lh_faces.max() == lh_points.shape[0] - 1 - assert lh_use_faces.min() >= 0 - assert lh_use_faces.max() <= lh_points.shape[0] - 1 - assert rh_faces.min() == 0 - assert rh_faces.max() == rh_points.shape[0] - 1 - assert rh_use_faces.min() >= 0 - assert rh_use_faces.max() <= lh_points.shape[0] - 1 + assert_true(lh_faces.min() == 0) + assert_true(lh_faces.max() == lh_points.shape[0] - 1) + assert_true(lh_use_faces.min() >= 0) + assert_true(lh_use_faces.max() <= lh_points.shape[0] - 1) + assert_true(rh_faces.min() == 0) + assert_true(rh_faces.max() == rh_points.shape[0] - 1) + assert_true(rh_use_faces.min() >= 0) + assert_true(rh_use_faces.max() <= lh_points.shape[0] - 1) diff --git a/mne/time_frequency/tests/test_psd.py b/mne/time_frequency/tests/test_psd.py index 88b971e..5d70405 100644 --- a/mne/time_frequency/tests/test_psd.py +++ b/mne/time_frequency/tests/test_psd.py @@ -1,6 +1,7 @@ import numpy as np import os.path as op from numpy.testing import assert_array_almost_equal +from nose.tools import assert_true from ... import fiff, Epochs, read_events from ...time_frequency import compute_raw_psd @@ -28,6 +29,6 @@ def test_psd(): psds, freqs = compute_raw_psd(raw, tmin=tmin, tmax=tmax, picks=picks, fmin=fmin, fmax=fmax, NFFT=NFFT, n_jobs=1) - assert psds.shape == (len(picks), len(freqs)) - assert np.sum(freqs < 0) == 0 - assert np.sum(psds < 0) == 0 + assert_true(psds.shape == (len(picks), len(freqs))) + assert_true(np.sum(freqs < 0) == 0) + assert_true(np.sum(psds < 0) == 0) diff --git a/mne/time_frequency/tests/test_tfr.py b/mne/time_frequency/tests/test_tfr.py index b73545a..b94b0c3 100644 --- a/mne/time_frequency/tests/test_tfr.py +++ b/mne/time_frequency/tests/test_tfr.py @@ -1,6 +1,7 @@ import numpy as np import os.path as op from numpy.testing import assert_array_almost_equal +from nose.tools import assert_true from ... import fiff, Epochs, read_events from ...time_frequency import induced_power, single_trial_power @@ -41,21 +42,21 @@ def test_time_frequency(): power, phase_lock = induced_power(data, Fs=Fs, frequencies=frequencies, n_cycles=2, use_fft=True) - assert power.shape == (len(picks), len(frequencies), len(times)) - assert power.shape == phase_lock.shape - assert np.sum(phase_lock >= 1) == 0 - assert np.sum(phase_lock <= 0) == 0 + assert_true(power.shape == (len(picks), len(frequencies), len(times))) + assert_true(power.shape == phase_lock.shape) + assert_true(np.sum(phase_lock >= 1) == 0) + assert_true(np.sum(phase_lock <= 0) == 0) power, phase_lock = induced_power(data, Fs=Fs, frequencies=frequencies, n_cycles=2, use_fft=False) - assert power.shape == (len(picks), len(frequencies), len(times)) - assert power.shape == phase_lock.shape - assert np.sum(phase_lock >= 1) == 0 - assert np.sum(phase_lock <= 0) == 0 + assert_true(power.shape == (len(picks), len(frequencies), len(times))) + assert_true(power.shape == phase_lock.shape) + assert_true(np.sum(phase_lock >= 1) == 0) + assert_true(np.sum(phase_lock <= 0) == 0) tfr = cwt_morlet(data[0], Fs, frequencies, use_fft=True, n_cycles=2) - assert tfr.shape == (len(picks), len(frequencies), len(times)) + assert_true(tfr.shape == (len(picks), len(frequencies), len(times))) single_power = single_trial_power(data, Fs, frequencies, use_fft=False, n_cycles=2) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
