Showing the changes to python/tests (1 of 1 file). Show all
Unified · Split
| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | #! /usr/bin/env python |
| 2 | 2 | |
| 3 | 3 | from numpy.testing import TestCase, assert_equal, assert_array_less |
| 4 | +from ._tools import parametrize | |
| 4 | 5 | from aubio import fvec, cvec, pvoc, float_type |
| 5 | −from nose2 import main | |
| 6 | −from nose2.tools import params | |
| 7 | 6 | import numpy as np |
| 8 | 7 | |
| 9 | 8 | if float_type == 'float32': |
| @@ -18,7 +17,7 @@ def create_sine(hop_s, freq, samplerate): · 8 unmodified lines | ||
| 18 | 17 | def create_noise(hop_s): |
| 19 | 18 | return np.random.rand(hop_s).astype(float_type) * 2. - 1. |
| 20 | 19 | |
| 21 | −class aubio_pvoc_test_case(TestCase): | |
| 20 | +class Test_aubio_pvoc_test_case: | |
| 22 | 21 | """ pvoc object test case """ |
| 23 | 22 | |
| 24 | 23 | def test_members_automatic_sizes_default(self): |
| @@ -56,7 +55,8 @@ class aubio_pvoc_test_case(TestCase): · 31 unmodified lines | ||
| 56 | 55 | + 'This is expected when using fftw3 on powerpc.') |
| 57 | 56 | assert_equal ( r, 0.) |
| 58 | 57 | |
| 59 | − @params( | |
| 58 | + resynth_noise_args = "hop_s, ratio" | |
| 59 | + resynth_noise_values = [ | |
| 60 | 60 | ( 256, 8), |
| 61 | 61 | ( 256, 4), |
| 62 | 62 | ( 256, 2), |
| @@ -78,13 +78,16 @@ class aubio_pvoc_test_case(TestCase): · 15 unmodified lines | ||
| 78 | 78 | (8192, 8), |
| 79 | 79 | (8192, 4), |
| 80 | 80 | (8192, 2), |
| 81 | − ) | |
| 81 | + ] | |
| 82 | + | |
| 83 | + @parametrize(resynth_noise_args, resynth_noise_values) | |
| 82 | 84 | def test_resynth_steps_noise(self, hop_s, ratio): |
| 83 | 85 | """ check the resynthesis of a random signal is correct """ |
| 84 | 86 | sigin = create_noise(hop_s) |
| 85 | 87 | self.reconstruction(sigin, hop_s, ratio) |
| 86 | 88 | |
| 87 | − @params( | |
| 89 | + resynth_sine_args = "samplerate, hop_s, ratio, freq" | |
| 90 | + resynth_sine_values = [ | |
| 88 | 91 | (44100, 256, 8, 441), |
| 89 | 92 | (44100, 256, 4, 1203), |
| 90 | 93 | (44100, 256, 2, 3045), |
| @@ -99,7 +102,9 @@ class aubio_pvoc_test_case(TestCase): · 8 unmodified lines | ||
| 99 | 102 | (22050, 256, 8, 445), |
| 100 | 103 | (96000, 1024, 8, 47000), |
| 101 | 104 | (96000, 1024, 8, 20), |
| 102 | − ) | |
| 105 | + ] | |
| 106 | + | |
| 107 | + @parametrize(resynth_sine_args, resynth_sine_values) | |
| 103 | 108 | def test_resynth_steps_sine(self, samplerate, hop_s, ratio, freq): |
| 104 | 109 | """ check the resynthesis of a sine is correct """ |
| 105 | 110 | sigin = create_sine(hop_s, freq, samplerate) |
| @@ -190,5 +195,5 @@ class aubio_pvoc_wrong_params(TestCase): · 84 unmodified lines | ||
| 190 | 195 | self.skipTest('creating aubio.pvoc with size %d did not fail' % win_s) |
| 191 | 196 | |
| 192 | 197 | if __name__ == '__main__': |
| 198 | + from unittest import main | |
| 193 | 199 | main() |
| 194 | − | |