From: Paul Brossier Date: Tue, 30 Oct 2018 09:15:10 +0000 (+0100) Subject: [py] [test] expect a small rounding error when using double precision X-Git-Tag: 0.4.8~92^2^2 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=27ed546f53a56f83e3e678c040d6eadd11b1965f;p=aubio.git [py] [test] expect a small rounding error when using double precision --- 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