From 27ed546f53a56f83e3e678c040d6eadd11b1965f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 30 Oct 2018 10:15:10 +0100 Subject: [PATCH] [py] [test] expect a small rounding error when using double precision --- python/tests/test_note2midi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/tests/test_note2midi.py b/python/tests/test_note2midi.py index 37c9db4a..3bbf1c87 100755 --- 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 @@ class note2freq_simple_test(unittest.TestCase): 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 -- 2.11.0