History

[tests] use _tools in test_midi2note

Paul Brossier committed 8 years ago

Commit 4c1eff41 parent 38592a61 file · +11 −12Browse files

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

Unified · Split

python/tests/test_midi2note.py+11−12
@@ -2,8 +2,7 @@ · 1 unmodified line
22 # -*- coding: utf-8 -*-
33
44 from aubio import midi2note
5−from nose2.tools import params
6−import unittest
5+from ._tools import parametrize, assert_raises
76
87 list_of_known_midis = (
98 ( 0, 'C-1' ),
@@ -15,31 +14,31 @@ list_of_known_midis = ( · 5 unmodified lines
1514 ( 127, 'G9' ),
1615 )
1716
18−class midi2note_good_values(unittest.TestCase):
17+class Test_midi2note_good_values:
1918
20− @params(*list_of_known_midis)
19+ @parametrize('midi, note', list_of_known_midis)
2120 def test_midi2note_known_values(self, midi, note):
2221 " known values are correctly converted "
23− self.assertEqual ( midi2note(midi), note )
22+ assert midi2note(midi) == (note)
2423
25−class midi2note_wrong_values(unittest.TestCase):
24+class Test_midi2note_wrong_values:
2625
2726 def test_midi2note_negative_value(self):
2827 " fails when passed a negative value "
29− self.assertRaises(ValueError, midi2note, -2)
28+ assert_raises(ValueError, midi2note, -2)
3029
3130 def test_midi2note_large(self):
3231 " fails when passed a value greater than 127 "
33− self.assertRaises(ValueError, midi2note, 128)
32+ assert_raises(ValueError, midi2note, 128)
3433
3534 def test_midi2note_floating_value(self):
3635 " fails when passed a floating point "
37− self.assertRaises(TypeError, midi2note, 69.2)
36+ assert_raises(TypeError, midi2note, 69.2)
3837
3938 def test_midi2note_character_value(self):
4039 " fails when passed a value that can not be transformed to integer "
41− self.assertRaises(TypeError, midi2note, "a")
40+ assert_raises(TypeError, midi2note, "a")
4241
4342 if __name__ == '__main__':
44− import nose2
45− nose2.main()
43+ from unittest import main
44+ 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