History

[tests] use _tools in test_phasevoc

Paul Brossier committed 8 years ago

Commit 7debeb61 parent 86deeed1 file · +13 −8Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/tests/test_phasevoc.py+13−8
@@ -1,9 +1,8 @@
11 #! /usr/bin/env python
22
33 from numpy.testing import TestCase, assert_equal, assert_array_less
4+from ._tools import parametrize
45 from aubio import fvec, cvec, pvoc, float_type
5−from nose2 import main
6−from nose2.tools import params
76 import numpy as np
87
98 if float_type == 'float32':
@@ -18,7 +17,7 @@ def create_sine(hop_s, freq, samplerate): · 8 unmodified lines
1817 def create_noise(hop_s):
1918 return np.random.rand(hop_s).astype(float_type) * 2. - 1.
2019
21−class aubio_pvoc_test_case(TestCase):
20+class Test_aubio_pvoc_test_case:
2221 """ pvoc object test case """
2322
2423 def test_members_automatic_sizes_default(self):
@@ -56,7 +55,8 @@ class aubio_pvoc_test_case(TestCase): · 31 unmodified lines
5655 + 'This is expected when using fftw3 on powerpc.')
5756 assert_equal ( r, 0.)
5857
59− @params(
58+ resynth_noise_args = "hop_s, ratio"
59+ resynth_noise_values = [
6060 ( 256, 8),
6161 ( 256, 4),
6262 ( 256, 2),
@@ -78,13 +78,16 @@ class aubio_pvoc_test_case(TestCase): · 15 unmodified lines
7878 (8192, 8),
7979 (8192, 4),
8080 (8192, 2),
81− )
81+ ]
82+
83+ @parametrize(resynth_noise_args, resynth_noise_values)
8284 def test_resynth_steps_noise(self, hop_s, ratio):
8385 """ check the resynthesis of a random signal is correct """
8486 sigin = create_noise(hop_s)
8587 self.reconstruction(sigin, hop_s, ratio)
8688
87− @params(
89+ resynth_sine_args = "samplerate, hop_s, ratio, freq"
90+ resynth_sine_values = [
8891 (44100, 256, 8, 441),
8992 (44100, 256, 4, 1203),
9093 (44100, 256, 2, 3045),
@@ -99,7 +102,9 @@ class aubio_pvoc_test_case(TestCase): · 8 unmodified lines
99102 (22050, 256, 8, 445),
100103 (96000, 1024, 8, 47000),
101104 (96000, 1024, 8, 20),
102− )
105+ ]
106+
107+ @parametrize(resynth_sine_args, resynth_sine_values)
103108 def test_resynth_steps_sine(self, samplerate, hop_s, ratio, freq):
104109 """ check the resynthesis of a sine is correct """
105110 sigin = create_sine(hop_s, freq, samplerate)
@@ -190,5 +195,5 @@ class aubio_pvoc_wrong_params(TestCase): · 84 unmodified lines
190195 self.skipTest('creating aubio.pvoc with size %d did not fail' % win_s)
191196
192197 if __name__ == '__main__':
198+ from unittest import main
193199 main()
194−

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t