Ignore:
Timestamp:
Dec 19, 2018, 6:29:13 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
b2e1740, d0f19a7, f5adffe
Parents:
a617bf3 (diff), 74c1fb9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/pytest' (closes #163)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_filterbank_mel.py

    ra617bf3 r0045668  
    33import numpy as np
    44from numpy.testing import TestCase, assert_equal, assert_almost_equal
     5from _tools import assert_warns
    56
    67from aubio import fvec, cvec, filterbank, float_type
    7 
    8 import warnings
    9 warnings.filterwarnings('ignore', category=UserWarning, append=True)
    108
    119class aubio_filterbank_mel_test_case(TestCase):
     
    7674        freq_list = [0, samplerate//4, samplerate // 2 + 1]
    7775        f = filterbank(len(freq_list)-2, 1024)
    78         # TODO add assert_warns
    79         f.set_triangle_bands(fvec(freq_list), samplerate)
     76        with assert_warns(UserWarning):
     77            f.set_triangle_bands(fvec(freq_list), samplerate)
    8078
    8179    def test_triangle_freqs_with_not_enough_filters(self):
     
    8482        freq_list = [0, 100, 1000, 4000, 8000, 10000]
    8583        f = filterbank(len(freq_list)-3, 1024)
    86         # TODO add assert_warns
    87         f.set_triangle_bands(fvec(freq_list), samplerate)
     84        with assert_warns(UserWarning):
     85            f.set_triangle_bands(fvec(freq_list), samplerate)
    8886
    8987    def test_triangle_freqs_with_too_many_filters(self):
     
    9290        freq_list = [0, 100, 1000, 4000, 8000, 10000]
    9391        f = filterbank(len(freq_list)-1, 1024)
    94         # TODO add assert_warns
    95         f.set_triangle_bands(fvec(freq_list), samplerate)
     92        with assert_warns(UserWarning):
     93            f.set_triangle_bands(fvec(freq_list), samplerate)
    9694
    9795    def test_triangle_freqs_with_double_value(self):
     
    10098        freq_list = [0, 100, 1000, 4000, 4000, 4000, 10000]
    10199        f = filterbank(len(freq_list)-2, 1024)
    102         # TODO add assert_warns
    103         f.set_triangle_bands(fvec(freq_list), samplerate)
     100        with assert_warns(UserWarning):
     101            f.set_triangle_bands(fvec(freq_list), samplerate)
    104102
    105103    def test_triangle_freqs_with_triple(self):
     
    108106        freq_list = [0, 100, 1000, 4000, 4000, 4000, 10000]
    109107        f = filterbank(len(freq_list)-2, 1024)
    110         # TODO add assert_warns
    111         f.set_triangle_bands(fvec(freq_list), samplerate)
     108        with assert_warns(UserWarning):
     109            f.set_triangle_bands(fvec(freq_list), samplerate)
     110
    112111
    113112    def test_triangle_freqs_without_norm(self):
     
    169168
    170169if __name__ == '__main__':
    171     import nose2
    172     nose2.main()
     170    from unittest import main
     171    main()
Note: See TracChangeset for help on using the changeset viewer.