From cb76f5d90002b9d2f8c3a384b45377c909fa5f8a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 18 Dec 2016 11:27:45 +0100 Subject: [PATCH] python/tests/test_notes.py: add basic tests --- python/tests/test_notes.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 python/tests/test_notes.py diff --git a/python/tests/test_notes.py b/python/tests/test_notes.py new file mode 100644 index 00000000..e774907c --- /dev/null +++ b/python/tests/test_notes.py @@ -0,0 +1,42 @@ +#! /usr/bin/env python + +from unittest import main +from numpy.testing import TestCase, assert_equal, assert_almost_equal +from aubio import notes + +AUBIO_DEFAULT_NOTES_SILENCE = -70. +AUBIO_DEFAULT_NOTES_MINIOI_MS = 30. + +class aubio_notes_default(TestCase): + + def test_members(self): + o = notes() + assert_equal ([o.buf_size, o.hop_size, o.method, o.samplerate], + [1024,512,'default',44100]) + + +class aubio_notes_params(TestCase): + + samplerate = 44100 + + def setUp(self): + self.o = notes(samplerate = self.samplerate) + + def test_get_minioi_ms(self): + assert_equal (self.o.get_minioi_ms(), AUBIO_DEFAULT_NOTES_MINIOI_MS) + + def test_set_minioi_ms(self): + val = 40. + self.o.set_minioi_ms(val) + assert_almost_equal (self.o.get_minioi_ms(), val) + + def test_get_silence(self): + assert_equal (self.o.get_silence(), AUBIO_DEFAULT_NOTES_SILENCE) + + def test_set_silence(self): + val = -50 + self.o.set_silence(val) + assert_equal (self.o.get_silence(), val) + +if __name__ == '__main__': + main() -- 2.11.0