projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ce504d
)
[py] [test] expect a small rounding error when using double precision
author
Paul Brossier
<piem@piem.org>
Tue, 30 Oct 2018 09:15:10 +0000
(10:15 +0100)
committer
Paul Brossier
<piem@piem.org>
Tue, 30 Oct 2018 09:15:10 +0000
(10:15 +0100)
python/tests/test_note2midi.py
patch
|
blob
|
history
diff --git
a/python/tests/test_note2midi.py
b/python/tests/test_note2midi.py
index
37c9db4
..
3bbf1c8
100755
(executable)
--- a/
python/tests/test_note2midi.py
+++ b/
python/tests/test_note2midi.py
@@
-3,7
+3,7
@@
from __future__ import unicode_literals
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
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"
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
if __name__ == '__main__':
import nose2