Showing the changes to python (6 of 6 files). Show all
Unified · Split
| @@ -14,7 +14,7 @@ samplerate = 44100 · 13 unmodified lines | |||
| 14 | new_params = ['buf_size', 'n_filters', 'n_coeffs', 'samplerate'] | 14 | new_params = ['buf_size', 'n_filters', 'n_coeffs', 'samplerate'] |
| 15 | new_deflts = [1024, 40, 13, 44100] | 15 | new_deflts = [1024, 40, 13, 44100] |
| 16 | 16 | ||
| 17 | class Test_aubio_mfcc: | 17 | class Test_aubio_mfcc(object): |
| 18 | 18 | ||
| 19 | members_args = 'name' | 19 | members_args = 'name' |
| 20 | 20 | ||
| @@ -74,7 +74,7 @@ class aubio_mfcc_compute(TestCase): · 53 unmodified lines | |||
| 74 | #print coeffs | 74 | #print coeffs |
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | class Test_aubio_mfcc_all_parameters: | 77 | class Test_aubio_mfcc_all_parameters(object): |
| 78 | 78 | ||
| 79 | run_values = [ | 79 | run_values = [ |
| 80 | (2048, 40, 13, 44100), | 80 | (2048, 40, 13, 44100), |
| @@ -14,14 +14,14 @@ list_of_known_midis = ( · 13 unmodified lines | |||
| 14 | ( 127, 'G9' ), | 14 | ( 127, 'G9' ), |
| 15 | ) | 15 | ) |
| 16 | 16 | ||
| 17 | class Test_midi2note_good_values: | 17 | class Test_midi2note_good_values(object): |
| 18 | 18 | ||
| 19 | @parametrize('midi, note', list_of_known_midis) | 19 | @parametrize('midi, note', list_of_known_midis) |
| 20 | def test_midi2note_known_values(self, midi, note): | 20 | def test_midi2note_known_values(self, midi, note): |
| 21 | " known values are correctly converted " | 21 | " known values are correctly converted " |
| 22 | assert midi2note(midi) == (note) | 22 | assert midi2note(midi) == (note) |
| 23 | 23 | ||
| 24 | class Test_midi2note_wrong_values: | 24 | class Test_midi2note_wrong_values(object): |
| 25 | 25 | ||
| 26 | def test_midi2note_negative_value(self): | 26 | def test_midi2note_negative_value(self): |
| 27 | " fails when passed a negative value " | 27 | " fails when passed a negative value " |
| @@ -44,7 +44,7 @@ list_of_unknown_notes = ( · 43 unmodified lines | |||
| 44 | ( '2' ), | 44 | ( '2' ), |
| 45 | ) | 45 | ) |
| 46 | 46 | ||
| 47 | class Test_note2midi_good_values: | 47 | class Test_note2midi_good_values(object): |
| 48 | 48 | ||
| 49 | @parametrize('note, midi', list_of_known_notes) | 49 | @parametrize('note, midi', list_of_known_notes) |
| 50 | def test_note2midi_known_values(self, note, midi): | 50 | def test_note2midi_known_values(self, note, midi): |
| @@ -107,7 +107,7 @@ class note2midi_wrong_values(TestCase): · 56 unmodified lines | |||
| 107 | " fails when passed a note with a note name longer than expected" | 107 | " fails when passed a note with a note name longer than expected" |
| 108 | self.assertRaises(ValueError, note2midi, 'CB+-3') | 108 | self.assertRaises(ValueError, note2midi, 'CB+-3') |
| 109 | 109 | ||
| 110 | class Test_note2midi_unknown_values: | 110 | class Test_note2midi_unknown_values(object): |
| 111 | 111 | ||
| 112 | @parametrize('note', list_of_unknown_notes) | 112 | @parametrize('note', list_of_unknown_notes) |
| 113 | def test_note2midi_unknown_values(self, note): | 113 | def test_note2midi_unknown_values(self, note): |
| @@ -17,7 +17,7 @@ def create_sine(hop_s, freq, samplerate): · 16 unmodified lines | |||
| 17 | def create_noise(hop_s): | 17 | def create_noise(hop_s): |
| 18 | return np.random.rand(hop_s).astype(float_type) * 2. - 1. | 18 | return np.random.rand(hop_s).astype(float_type) * 2. - 1. |
| 19 | 19 | ||
| 20 | class Test_aubio_pvoc_test_case: | 20 | class Test_aubio_pvoc_test_case(object): |
| 21 | """ pvoc object test case """ | 21 | """ pvoc object test case """ |
| 22 | 22 | ||
| 23 | def test_members_automatic_sizes_default(self): | 23 | def test_members_automatic_sizes_default(self): |
| @@ -19,7 +19,7 @@ for soundfile in list_of_sounds: · 18 unmodified lines | |||
| 19 | for samplerate in samplerates: | 19 | for samplerate in samplerates: |
| 20 | all_params.append((hop_size, samplerate, soundfile)) | 20 | all_params.append((hop_size, samplerate, soundfile)) |
| 21 | 21 | ||
| 22 | class Test_aubio_sink: | 22 | class Test_aubio_sink(object): |
| 23 | 23 | ||
| 24 | def test_wrong_filename(self): | 24 | def test_wrong_filename(self): |
| 25 | with assert_raises(RuntimeError): | 25 | with assert_raises(RuntimeError): |
| @@ -23,7 +23,7 @@ no_sounds_msg = "no test sounds, add some in 'python/tests/sounds/'!" · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | _debug = False | 24 | _debug = False |
| 25 | 25 | ||
| 26 | class Test_aubio_source_test_case: | 26 | class Test_aubio_source_test_case(object): |
| 27 | 27 | ||
| 28 | @parametrize('filename', list_of_sounds) | 28 | @parametrize('filename', list_of_sounds) |
| 29 | def test_close_file(self, filename): | 29 | def test_close_file(self, filename): |
| @@ -40,7 +40,7 @@ class Test_aubio_source_test_case: · 10 unmodified lines | |||
| 40 | f.close() | 40 | f.close() |
| 41 | f.close() | 41 | f.close() |
| 42 | 42 | ||
| 43 | class Test_aubio_source_read: | 43 | class Test_aubio_source_read(object): |
| 44 | 44 | ||
| 45 | def read_from_source(self, f): | 45 | def read_from_source(self, f): |
| 46 | total_frames = 0 | 46 | total_frames = 0 |
| @@ -118,7 +118,7 @@ class Test_aubio_source_read: · 71 unmodified lines | |||
| 118 | assert_equal (duration, total_frames) | 118 | assert_equal (duration, total_frames) |
| 119 | 119 | ||
| 120 | 120 | ||
| 121 | class Test_aubio_source_wrong_params: | 121 | class Test_aubio_source_wrong_params(object): |
| 122 | 122 | ||
| 123 | def test_wrong_file(self): | 123 | def test_wrong_file(self): |
| 124 | with assert_raises(RuntimeError): | 124 | with assert_raises(RuntimeError): |
| @@ -171,7 +171,7 @@ class Test_aubio_source_readmulti(Test_aubio_source_read): · 46 unmodified lines | |||
| 171 | print (result_str.format(*result_params)) | 171 | print (result_str.format(*result_params)) |
| 172 | return total_frames | 172 | return total_frames |
| 173 | 173 | ||
| 174 | class Test_aubio_source_with: | 174 | class Test_aubio_source_with(object): |
| 175 | 175 | ||
| 176 | @parametrize('filename', list_of_sounds) | 176 | @parametrize('filename', list_of_sounds) |
| 177 | def test_read_from_mono(self, filename): | 177 | def test_read_from_mono(self, filename): |