shithub: aubio

Download patch

ref: 2871e2b03bbc9800615603264aeacb91b347ff07
parent: 84838c3a967bbda30f250b4292af3c4c986a60e1
author: Paul Brossier <piem@piem.org>
date: Tue May 10 22:52:19 EDT 2016

python/tests/test_filter.py: add tests

--- a/python/tests/test_filter.py
+++ b/python/tests/test_filter.py
@@ -68,7 +68,21 @@
     u = f(v)
     assert_almost_equal (expected[1][16:], u)
 
-if __name__ == '__main__':
-  from unittest import main
-  main()
+  def test_set_biquad(self):
+    f = digital_filter(3)
+    f.set_biquad(0., 0., 0, 0., 0.)
 
+  def test_set_biquad_wrong_order(self):
+    f = digital_filter(4)
+    with self.assertRaises(ValueError):
+        f.set_biquad(0., 0., 0, 0., 0.)
+
+class aubio_filter_wrong_params(TestCase):
+
+    def test_negative_order(self):
+        with self.assertRaises(ValueError):
+            digital_filter(-1)
+
+if __name__ == '__main__':
+    from unittest import main
+    main()