Ignore:
Timestamp:
Dec 19, 2018, 6:29:13 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
b2e1740, d0f19a7, f5adffe
Parents:
a617bf3 (diff), 74c1fb9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/pytest' (closes #163)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_midi2note.py

    ra617bf3 r0045668  
    33
    44from aubio import midi2note
    5 from nose2.tools import params
    6 import unittest
     5from _tools import parametrize, assert_raises
    76
    87list_of_known_midis = (
     
    1615        )
    1716
    18 class midi2note_good_values(unittest.TestCase):
     17class Test_midi2note_good_values(object):
    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):
     24class Test_midi2note_wrong_values(object):
    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
    4342if __name__ == '__main__':
    44     import nose2
    45     nose2.main()
     43    from _tools import run_module_suite
     44    run_module_suite()
Note: See TracChangeset for help on using the changeset viewer.