shithub: aubio

Download patch

ref: 27ed546f53a56f83e3e678c040d6eadd11b1965f
parent: 5ce504dbacd2d43d84c951bdfc900fcd6f2a8065
author: Paul Brossier <piem@piem.org>
date: Tue Oct 30 06:15:10 EDT 2018

[py] [test] expect a small rounding error when using double precision

--- a/python/tests/test_note2midi.py
+++ b/python/tests/test_note2midi.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 
-from aubio import note2midi, freq2note, note2freq
+from aubio import note2midi, freq2note, note2freq, float_type
 from nose2.tools import params
 import unittest
 
@@ -127,7 +127,10 @@
 
     def test_note2freq_under(self):
         " make sure note2freq(A4) == 440"
-        self.assertEqual(440, note2freq("A4"))
+        if float_type == 'float32':
+            self.assertEqual(440, note2freq("A4"))
+        else:
+            self.assertLess(abs(note2freq("A4")-440), 1.e-12)
 
 if __name__ == '__main__':
     import nose2