Ignore:
Timestamp:
Jun 22, 2016, 1:00:10 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:
4b9443c4
Parents:
60fc05b (diff), 6769586 (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 'master' into notes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_note2midi.py

    r60fc05b rf264b17  
    22# -*- coding: utf-8 -*-
    33
    4 from aubio import note2midi
     4from __future__ import unicode_literals
     5
     6from aubio import note2midi, freq2note
    57import unittest
    68
     
    1517        ( 'A#4', 70 ),
    1618        ( 'Bb4', 70 ),
    17         ( u'B♭4', 70 ),
     19        ( 'B♭4', 70 ),
    1820        ( 'G8', 115 ),
    19         ( u'G♯8', 116 ),
     21        ( 'G♯8', 116 ),
    2022        ( 'G9', 127 ),
    21         ( u'G\udd2a2', 45 ),
    22         ( u'B\ufffd2', 45 ),
    23         ( u'A♮2', 45 ),
     23        ( 'G\udd2a2', 45 ),
     24        ( 'B\ufffd2', 45 ),
     25        ( 'A♮2', 45 ),
    2426        )
    2527
     
    5052
    5153    def test_note2midi_out_of_range(self):
    52         " fails when passed a out of range note"
     54        " fails when passed a note out of range"
    5355        self.assertRaises(ValueError, note2midi, 'A9')
     56
     57    def test_note2midi_wrong_note_name(self):
     58        " fails when passed a note with a wrong name"
     59        self.assertRaises(ValueError, note2midi, 'W9')
     60
     61    def test_note2midi_low_octave(self):
     62        " fails when passed a note with a too low octave"
     63        self.assertRaises(ValueError, note2midi, 'C-9')
    5464
    5565    def test_note2midi_wrong_data_type(self):
     
    5767        self.assertRaises(TypeError, note2midi, 123)
    5868
     69
     70class freq2note_simple_test(unittest.TestCase):
     71
     72    def test_freq2note(self):
     73        " make sure freq2note(441) == A4 "
     74        self.assertEqual("A4", freq2note(441))
     75
    5976if __name__ == '__main__':
    6077    unittest.main()
Note: See TracChangeset for help on using the changeset viewer.