Changeset 6db7600


Ignore:
Timestamp:
Apr 18, 2016, 11:27:54 PM (8 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, pitchshift, sampler, timestretch, yinfft+
Children:
376d5e9
Parents:
689106e
Message:

tests/test_note2midi.py: more tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_note2midi.py

    r689106e r6db7600  
    22# -*- coding: utf-8 -*-
    33
    4 from aubio import note2midi
     4from aubio import note2midi, freq2note
    55import unittest
    66
     
    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')
     54
     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')
    5462
    5563    def test_note2midi_wrong_data_type(self):
     
    5765        self.assertRaises(TypeError, note2midi, 123)
    5866
     67
     68class freq2note_simple_test(unittest.TestCase):
     69
     70    def test_freq2note(self):
     71        " make sure freq2note(441) == A4 "
     72        self.assertEquals("A4", freq2note(441))
     73
    5974if __name__ == '__main__':
    6075    unittest.main()
Note: See TracChangeset for help on using the changeset viewer.