History

tests/test_note2midi.py: more tests

Paul Brossier committed 10 years ago

Commit 6db76001 parent 689106e1 file · +17 −2Browse files

Showing the changes to python/tests (1 of 1 file). Show all

Unified · Split

python/tests/test_note2midi.py+17−2
@@ -1,7 +1,7 @@
11 #! /usr/bin/env python
22 # -*- coding: utf-8 -*-
33
4−from aubio import note2midi
4+from aubio import note2midi, freq2note
55 import unittest
66
77 list_of_known_notes = (
@@ -49,12 +49,27 @@ class note2midi_wrong_values(unittest.TestCase): · 41 unmodified lines
4949 self.assertRaises(ValueError, note2midi, 'CBc')
5050
5151 def test_note2midi_out_of_range(self):
52− " fails when passed a out of range note"
52+ " fails when passed a note out of range"
5353 self.assertRaises(ValueError, note2midi, 'A9')
5454
55+ def test_note2midi_wrong_note_name(self):
56+ " fails when passed a note with a wrong name"
57+ self.assertRaises(ValueError, note2midi, 'W9')
58+
59+ def test_note2midi_wrong_octave(self):
60+ " fails when passed a note with a wrong octave"
61+ self.assertRaises(ValueError, note2midi, 'C-9')
62+
5563 def test_note2midi_wrong_data_type(self):
5664 " fails when passed a non-string value "
5765 self.assertRaises(TypeError, note2midi, 123)
5866
67+
68+class freq2note_simple_test(unittest.TestCase):
69+
70+ def test_freq2note(self):
71+ " make sure freq2note(441) == A4 "
72+ self.assertEquals("A4", freq2note(441))
73+
5974 if __name__ == '__main__':
6075 unittest.main()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t