History

Merge branch 'master' into feature/pytest

Paul Brossier committed 7 years ago

Commit d06c9a42 parents ff28d81 a114fe03 files · +62 −1Browse files

Showing the changes to python/tests (2 of 3 files). Show all

Unified · Split

2 files
  1. python/tests/test_filter.py +10 −0
  2. python/tests/test_onset.py +33 −1
python/tests/test_filter.py+10−0
@@ -76,6 +76,16 @@ class aubio_filter_test_case(TestCase): · 75 unmodified lines
76 with self.assertRaises(ValueError):76 with self.assertRaises(ValueError):
77 f.set_biquad(0., 0., 0, 0., 0.)77 f.set_biquad(0., 0., 0, 0., 0.)
78 78
79 def test_all_available_presets(self):
80 f = digital_filter(7)
81 for sr in [8000, 11025, 16000, 22050, 24000, 32000,
82 44100, 48000, 88200, 96000, 192000]:
83 f.set_a_weighting(sr)
84 f = digital_filter(5)
85 for sr in [8000, 11025, 16000, 22050, 24000, 32000,
86 44100, 48000, 88200, 96000, 192000]:
87 f.set_c_weighting(sr)
88
79class aubio_filter_wrong_params(TestCase):89class aubio_filter_wrong_params(TestCase):
80 90
81 def test_negative_order(self):91 def test_negative_order(self):
python/tests/test_onset.py+33−1
@@ -1,7 +1,7 @@
1#! /usr/bin/env python1#! /usr/bin/env python
2 2
3from numpy.testing import TestCase, assert_equal, assert_almost_equal3from numpy.testing import TestCase, assert_equal, assert_almost_equal
4from aubio import onset4from aubio import onset, fvec
5 5
6class aubio_onset_default(TestCase):6class aubio_onset_default(TestCase):
7 7
@@ -82,6 +82,38 @@ class aubio_onset_32000(aubio_onset_params): · 74 unmodified lines
82class aubio_onset_8000(aubio_onset_params):82class aubio_onset_8000(aubio_onset_params):
83 samplerate = 800083 samplerate = 8000
84 84
85class aubio_onset_coverate(TestCase):
86 # extra tests to execute the C routines and improve coverage
87
88 def test_all_methods(self):
89 for method in ['default', 'energy', 'hfc', 'complexdomain', 'complex',
90 'phase', 'wphase', 'mkl', 'kl', 'specflux', 'specdiff',
91 'old_default']:
92 o = onset(method=method, buf_size=512, hop_size=256)
93 o(fvec(256))
94
95 def test_get_methods(self):
96 o = onset(method='default', buf_size=512, hop_size=256)
97
98 assert o.get_silence() == -70
99 o.set_silence(-20)
100 assert_almost_equal(o.get_silence(), -20)
101
102 assert o.get_compression() == 1
103 o.set_compression(.99)
104 assert_almost_equal(o.get_compression(), .99)
105
106 assert o.get_awhitening() == 0
107 o.set_awhitening(1)
108 assert o.get_awhitening() == 1
109
110 o.get_last()
111 o.get_last_ms()
112 o.get_last_s()
113 o.get_descriptor()
114 o.get_thresholded_descriptor()
115
116
85if __name__ == '__main__':117if __name__ == '__main__':
86 from unittest import main118 from unittest import main
87 main()119 main()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t