shithub: aubio

Download patch

ref: 7d89e6187fffd9d6773778f192224ae6b12bd8b6
parent: 9ead7a9b1a1fe5c4b53480925c7f6890212f7689
author: Paul Brossier <piem@piem.org>
date: Sun Mar 10 07:37:28 EDT 2013

tests/test_{midi2note,note2midi}.py: add header and encoding

--- a/python/lib/aubio/midiconv.py
+++ b/python/lib/aubio/midiconv.py
@@ -1,10 +1,10 @@
-# -*- encoding: utf8 -*-
+# -*- coding: utf-8 -*-
 
 def note2midi(note):
     " convert note name to midi note number, e.g. [C-1, G9] -> [0, 127] "
     _valid_notenames = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
     _valid_modifiers = {None: 0, u'♮': 0, '#': +1, u'♯': +1, u'\udd2a': +2, 'b': -1, u'♭': -1, u'\ufffd': -2}
-    _valid_octaves = range(-1, 10) 
+    _valid_octaves = range(-1, 10)
     if type(note) not in (str, unicode):
         raise TypeError, "a string is required, got %s" % note
     if not (1 < len(note) < 5):
--- a/python/tests/test_midi2note.py
+++ b/python/tests/test_midi2note.py
@@ -1,4 +1,5 @@
-# -*- encoding: utf8 -*-
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
 
 from aubio import midi2note
 import unittest
@@ -13,7 +14,7 @@
         ( 127, 'G9' ),
         )
 
-class TestMidi2NoteGoodValues(unittest.TestCase):
+class midi2note_good_values(unittest.TestCase):
 
     def test_midi2note_known_values(self):
         " known values are correctly converted "
@@ -20,7 +21,7 @@
         for midi, note in list_of_known_midis:
             self.assertEqual ( midi2note(midi), note )
 
-class TestNote2MidiWrongValues(unittest.TestCase):
+class midi2note_wrong_values(unittest.TestCase):
 
     def test_midi2note_negative_value(self):
         " fails when passed a negative value "
--- a/python/tests/test_note2midi.py
+++ b/python/tests/test_note2midi.py
@@ -1,4 +1,5 @@
-# -*- encoding: utf8 -*-
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
 
 from aubio import note2midi
 import unittest
@@ -22,7 +23,7 @@
         ( u'A♮2', 45 ),
         )
 
-class TestNote2MidiGoodValues(unittest.TestCase):
+class note2midi_good_values(unittest.TestCase):
 
     def test_note2midi_known_values(self):
         " known values are correctly converted "
@@ -29,7 +30,7 @@
         for note, midi in list_of_known_notes:
             self.assertEqual ( note2midi(note), midi )
 
-class TestNote2MidiWrongValues(unittest.TestCase):
+class note2midi_wrong_values(unittest.TestCase):
 
     def test_note2midi_missing_octave(self):
         " fails when passed only one character"