Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -0,0 +1,42 @@ | |||
| 1 | #! /usr/bin/env python | ||
| 2 | |||
| 3 | from unittest import main | ||
| 4 | from numpy.testing import TestCase, assert_equal, assert_almost_equal | ||
| 5 | from aubio import notes | ||
| 6 | |||
| 7 | AUBIO_DEFAULT_NOTES_SILENCE = -70. | ||
| 8 | AUBIO_DEFAULT_NOTES_MINIOI_MS = 30. | ||
| 9 | |||
| 10 | class aubio_notes_default(TestCase): | ||
| 11 | |||
| 12 | def test_members(self): | ||
| 13 | o = notes() | ||
| 14 | assert_equal ([o.buf_size, o.hop_size, o.method, o.samplerate], | ||
| 15 | [1024,512,'default',44100]) | ||
| 16 | |||
| 17 | |||
| 18 | class aubio_notes_params(TestCase): | ||
| 19 | |||
| 20 | samplerate = 44100 | ||
| 21 | |||
| 22 | def setUp(self): | ||
| 23 | self.o = notes(samplerate = self.samplerate) | ||
| 24 | |||
| 25 | def test_get_minioi_ms(self): | ||
| 26 | assert_equal (self.o.get_minioi_ms(), AUBIO_DEFAULT_NOTES_MINIOI_MS) | ||
| 27 | |||
| 28 | def test_set_minioi_ms(self): | ||
| 29 | val = 40. | ||
| 30 | self.o.set_minioi_ms(val) | ||
| 31 | assert_almost_equal (self.o.get_minioi_ms(), val) | ||
| 32 | |||
| 33 | def test_get_silence(self): | ||
| 34 | assert_equal (self.o.get_silence(), AUBIO_DEFAULT_NOTES_SILENCE) | ||
| 35 | |||
| 36 | def test_set_silence(self): | ||
| 37 | val = -50 | ||
| 38 | self.o.set_silence(val) | ||
| 39 | assert_equal (self.o.get_silence(), val) | ||
| 40 | |||
| 41 | if __name__ == '__main__': | ||
| 42 | main() | ||