Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -5,7 +5,7 @@ from __future__ import unicode_literals · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | from aubio import note2midi, freq2note, note2freq, float_type |
| 7 | 7 | from numpy.testing import TestCase |
| 8 | −from _tools import parametrize, assert_raises | |
| 8 | +from _tools import parametrize, assert_raises, skipTest | |
| 9 | 9 | |
| 10 | 10 | list_of_known_notes = ( |
| 11 | 11 | ( 'C-1', 0 ), |
| @@ -53,16 +53,19 @@ class Test_note2midi_good_values: · 41 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | @parametrize('note, midi', list_of_known_notes_with_unicode_issues) |
| 55 | 55 | def test_note2midi_known_values_with_unicode_issues(self, note, midi): |
| 56 | − " known values are correctly converted, unless decoding is expected to fail" | |
| 56 | + " difficult values are correctly converted unless expected failure " | |
| 57 | 57 | try: |
| 58 | 58 | assert note2midi(note) == midi |
| 59 | 59 | except UnicodeEncodeError as e: |
| 60 | + # platforms with decoding failures include: | |
| 61 | + # - osx: python <= 2.7.10 | |
| 62 | + # - win: python <= 2.7.12 | |
| 60 | 63 | import sys |
| 61 | − strfmt = "len(u'\\U0001D12A') != 1, excpected decoding failure | {:s} | {:s} {:s}" | |
| 62 | − strres = strfmt.format(e, sys.platform, sys.version) | |
| 63 | − # happens with: darwin 2.7.10, windows 2.7.12 | |
| 64 | + strmsg = "len(u'\\U0001D12A') != 1, expected decoding failure" | |
| 65 | + strmsg += " | upgrade to Python 3 to fix" | |
| 66 | + strmsg += " | {:s} | {:s} {:s}" | |
| 64 | 67 | if len('\U0001D12A') != 1 and sys.version[0] == '2': |
| 65 | − skipTest(strres + " | upgrade to Python 3 to fix") | |
| 68 | + skipTest(strmsg.format(repr(e), sys.platform, sys.version)) | |
| 66 | 69 | else: |
| 67 | 70 | raise |
| 68 | 71 | |
| @@ -135,5 +138,5 @@ class note2freq_simple_test(TestCase): · 66 unmodified lines | ||
| 135 | 138 | self.assertLess(abs(note2freq("A4")-440), 1.e-12) |
| 136 | 139 | |
| 137 | 140 | if __name__ == '__main__': |
| 138 | − from unittest import main | |
| 139 | − main() | |
| 141 | + import sys, pytest | |
| 142 | + pytest.main(sys.argv) | |