Changeset 11c0d74


Ignore:
Timestamp:
Nov 17, 2018, 8:20:45 PM (6 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/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
a114fe0
Parents:
b41672c
Message:

[tests] improve onset coverage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_onset.py

    rb41672c r11c0d74  
    33from unittest import main
    44from numpy.testing import TestCase, assert_equal, assert_almost_equal
    5 from aubio import onset
     5from aubio import onset, fvec
    66
    77class aubio_onset_default(TestCase):
     
    8484    samplerate = 8000
    8585
     86class aubio_onset_coverate(TestCase):
     87    # extra tests to execute the C routines and improve coverage
     88
     89    def test_all_methods(self):
     90        for method in ['default', 'energy', 'hfc', 'complexdomain', 'complex',
     91                'phase', 'wphase', 'mkl', 'kl', 'specflux', 'specdiff',
     92                'old_default']:
     93            o = onset(method=method, buf_size=512, hop_size=256)
     94            o(fvec(256))
     95
     96    def test_get_methods(self):
     97        o = onset(method='default', buf_size=512, hop_size=256)
     98
     99        assert o.get_silence() == -70
     100        o.set_silence(-20)
     101        assert_almost_equal(o.get_silence(), -20)
     102
     103        assert o.get_compression() == 1
     104        o.set_compression(.99)
     105        assert_almost_equal(o.get_compression(), .99)
     106
     107        assert o.get_awhitening() == 0
     108        o.set_awhitening(1)
     109        assert o.get_awhitening() == 1
     110
     111        o.get_last()
     112        o.get_last_ms()
     113        o.get_last_s()
     114        o.get_descriptor()
     115        o.get_thresholded_descriptor()
     116
     117
    86118if __name__ == '__main__':
    87119    main()
Note: See TracChangeset for help on using the changeset viewer.