History

lib/aubio/midiconv.py: improve note2midi

Paul Brossier committed 13 years ago

Commit f552e9e1 parent 33102ab2 files · +14 −8Browse files

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

Unified · Split

python/tests/test_note2midi.py+11−6
@@ -12,9 +12,10 @@ list_of_known_notes = ( · 11 unmodified lines
1212 ( 'B#3', 60 ),
1313 ( 'A4', 69 ),
1414 ( 'A#4', 70 ),
15+ ( 'Bb4', 70 ),
16+ ( u'B♭4', 70 ),
1517 ( 'G8', 115 ),
1618 ( u'G♯8', 116 ),
17− ( u'G♭9', 126 ),
1819 ( 'G9', 127 ),
1920 ( u'G\udd2a2', 45 ),
2021 ( u'B\ufffd2', 45 ),
@@ -35,20 +36,24 @@ class TestNote2MidiWrongValues(unittest.TestCase): · 14 unmodified lines
3536 self.assertRaises(ValueError, note2midi, 'C')
3637
3738 def test_note2midi_wrong_modifier(self):
38− " fails when passed an invalid note name"
39+ " fails when passed a note with an invalid modifier "
3940 self.assertRaises(ValueError, note2midi, 'C.1')
4041
41− def test_note2midi_wronge_midifier_again(self):
42− " fails when passed a wrong modifier"
42+ def test_note2midi_another_wrong_modifier_again(self):
43+ " fails when passed a note with a invalid note name "
4344 self.assertRaises(ValueError, note2midi, 'CB-3')
4445
4546 def test_note2midi_wrong_octave(self):
46− " fails when passed a wrong octave"
47+ " fails when passed a wrong octave number "
4748 self.assertRaises(ValueError, note2midi, 'CBc')
4849
4950 def test_note2midi_out_of_range(self):
50− " fails when passed a non-existing note"
51+ " fails when passed a out of range note"
5152 self.assertRaises(ValueError, note2midi, 'A9')
5253
54+ def test_note2midi_wrong_data_type(self):
55+ " fails when passed a non-string value "
56+ self.assertRaises(TypeError, note2midi, 123)
57+
5358 if __name__ == '__main__':
5459 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