Changeset d554321 for python/tests


Ignore:
Timestamp:
Dec 2, 2016, 1:44:12 PM (7 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/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
Children:
3aad0b1
Parents:
473ab11
Message:

python/tests/test_{midi2note,note2midi}.py: use nose2.params, add unicode tests

Location:
python/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_midi2note.py

    r473ab11 rd554321  
    33
    44from aubio import midi2note
     5from nose2.tools import params
    56import unittest
    67
     
    1718class midi2note_good_values(unittest.TestCase):
    1819
    19     def test_midi2note_known_values(self):
     20    @params(*list_of_known_midis)
     21    def test_midi2note_known_values(self, midi, note):
    2022        " known values are correctly converted "
    21         for midi, note in list_of_known_midis:
    22             self.assertEqual ( midi2note(midi), note )
     23        self.assertEqual ( midi2note(midi), note )
    2324
    2425class midi2note_wrong_values(unittest.TestCase):
     
    4142
    4243if __name__ == '__main__':
    43     unittest.main()
     44    import nose2
     45    nose2.main()
  • python/tests/test_note2midi.py

    r473ab11 rd554321  
    55
    66from aubio import note2midi, freq2note
     7from nose2.tools import params
    78import unittest
    89
     
    1415        ( 'B3', 59 ),
    1516        ( 'B#3', 60 ),
     17        ( 'C\u266f4', 61 ),
     18        ( 'C\U0001D12A4', 62 ),
     19        ( 'E\U0001D12B4', 62 ),
    1620        ( 'A4', 69 ),
    1721        ( 'A#4', 70 ),
     
    2832class note2midi_good_values(unittest.TestCase):
    2933
    30     def test_note2midi_known_values(self):
     34    @params(*list_of_known_notes)
     35    def test_note2midi_known_values(self, note, midi):
    3136        " known values are correctly converted "
    32         for note, midi in list_of_known_notes:
    33             self.assertEqual ( note2midi(note), midi )
     37        self.assertEqual ( note2midi(note), midi )
    3438
    3539class note2midi_wrong_values(unittest.TestCase):
     
    7579
    7680if __name__ == '__main__':
    77     unittest.main()
     81    import nose2
     82    nose2.main()
Note: See TracChangeset for help on using the changeset viewer.