Showing the changes to python (1 of 2 files). Show all
Unified · Split
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | from __future__ import unicode_literals | 4 | from __future__ import unicode_literals |
| 5 | 5 | ||
| 6 | from aubio import note2midi, freq2note, note2freq | 6 | from aubio import note2midi, freq2note, note2freq, float_type |
| 7 | from nose2.tools import params | 7 | from nose2.tools import params |
| 8 | import unittest | 8 | import unittest |
| 9 | 9 | ||
| @@ -127,7 +127,10 @@ class note2freq_simple_test(unittest.TestCase): · 117 unmodified lines | |||
| 127 | 127 | ||
| 128 | def test_note2freq_under(self): | 128 | def test_note2freq_under(self): |
| 129 | " make sure note2freq(A4) == 440" | 129 | " make sure note2freq(A4) == 440" |
| 130 | self.assertEqual(440, note2freq("A4")) | 130 | if float_type == 'float32': |
| 131 | self.assertEqual(440, note2freq("A4")) | ||
| 132 | else: | ||
| 133 | self.assertLess(abs(note2freq("A4")-440), 1.e-12) | ||
| 131 | 134 | ||
| 132 | if __name__ == '__main__': | 135 | if __name__ == '__main__': |
| 133 | import nose2 | 136 | import nose2 |