Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -1,7 +1,7 @@ | |||
| 1 | #! /usr/bin/env python | 1 | #! /usr/bin/env python |
| 2 | 2 | ||
| 3 | from numpy.testing import TestCase | 3 | from numpy.testing import TestCase |
| 4 | from nose2.tools import params | 4 | from _tools import parametrize |
| 5 | import numpy as np | 5 | import numpy as np |
| 6 | import aubio | 6 | import aubio |
| 7 | 7 | ||
| @@ -66,15 +66,18 @@ class aubio_pitchshift_wrong_params(TestCase): · 58 unmodified lines | |||
| 66 | with self.assertRaises(RuntimeError): | 66 | with self.assertRaises(RuntimeError): |
| 67 | aubio.pitchshift("default", -123) | 67 | aubio.pitchshift("default", -123) |
| 68 | 68 | ||
| 69 | class aubio_pitchshift_testruns(TestCase): | 69 | class Test_aubio_pitchshift_testruns(object): |
| 70 | 70 | ||
| 71 | @params( | 71 | run_args = ['mode', 'pitchscale', 'hop_size', 'samplerate'] |
| 72 | run_values = [ | ||
| 72 | ("default", 1.2, 128, 44100), | 73 | ("default", 1.2, 128, 44100), |
| 73 | ("crispness:0", 0.43, 64, 8000), | 74 | ("crispness:0", 0.43, 64, 8000), |
| 74 | ("crispness:3", 0.53, 256, 8000), | 75 | ("crispness:3", 0.53, 256, 8000), |
| 75 | ("crispness:3", 1.53, 512, 8000), | 76 | ("crispness:3", 1.53, 512, 8000), |
| 76 | ("crispness:6", 2.3, 4096, 192000), | 77 | ("crispness:6", 2.3, 4096, 192000), |
| 77 | ) | 78 | ] |
| 79 | |||
| 80 | @parametrize(run_args, run_values) | ||
| 78 | def test_run_with_params(self, mode, pitchscale, hop_size, samplerate): | 81 | def test_run_with_params(self, mode, pitchscale, hop_size, samplerate): |
| 79 | try: | 82 | try: |
| 80 | self.o = aubio.pitchshift(mode, pitchscale, hop_size, samplerate) | 83 | self.o = aubio.pitchshift(mode, pitchscale, hop_size, samplerate) |
| @@ -97,5 +100,5 @@ class aubio_pitchshift_testruns(TestCase): · 16 unmodified lines | |||
| 97 | read += len(vec) | 100 | read += len(vec) |
| 98 | 101 | ||
| 99 | if __name__ == '__main__': | 102 | if __name__ == '__main__': |
| 100 | from nose2 import main | 103 | from _tools import run_module_suite |
| 101 | main() | 104 | run_module_suite() |