History

Merge branch 'master' into feature/pytest

Paul Brossier committed 7 years ago

Commit bbfa9a42 parents 8a11e2f db3eb5c20 files · +404 −107Browse files

Showing the changes to python (2 of 20 files). Show all

Unified · Split

2 files
  1. python/tests/test_phasevoc.py +9 −0
  2. python/tests/test_tempo.py +91 −0
python/tests/test_phasevoc.py+9−0
@@ -55,6 +55,15 @@ class Test_aubio_pvoc_test_case(object): · 54 unmodified lines
5555 + 'This is expected when using fftw3 on powerpc.')
5656 assert_equal ( r, 0.)
5757
58+ def test_no_overlap(self):
59+ win_s, hop_s = 1024, 1024
60+ f = pvoc (win_s, hop_s)
61+ t = fvec (hop_s)
62+ for _ in range(4):
63+ s = f(t)
64+ r = f.rdo(s)
65+ assert_equal ( t, 0.)
66+
5867 resynth_noise_args = "hop_s, ratio"
5968 resynth_noise_values = [
6069 ( 256, 8),
python/tests/test_tempo.py+91−0
@@ -0,0 +1,91 @@
1+#! /usr/bin/env python
2+
3+from unittest import main
4+from numpy.testing import TestCase, assert_equal, assert_almost_equal
5+import aubio
6+
7+class aubio_tempo_default(TestCase):
8+
9+ def test_members(self):
10+ o = aubio.tempo()
11+ assert_equal ([o.buf_size, o.hop_size, o.method, o.samplerate],
12+ [1024,512,'default',44100])
13+
14+class aubio_tempo_params(TestCase):
15+
16+ samplerate = 44100
17+
18+ def setUp(self):
19+ self.o = aubio.tempo(samplerate = self.samplerate)
20+
21+ def test_get_delay(self):
22+ self.assertEqual(self.o.get_delay(), 0)
23+
24+ def test_set_delay(self):
25+ val = 256
26+ self.o.set_delay(val)
27+ assert_equal (self.o.get_delay(), val)
28+
29+ def test_get_delay_s(self):
30+ self.assertEqual(self.o.get_delay_s(), 0.)
31+
32+ def test_set_delay_s(self):
33+ val = .05
34+ self.o.set_delay_s(val)
35+ assert_almost_equal (self.o.get_delay_s(), val)
36+
37+ def test_get_delay_ms(self):
38+ self.assertEqual(self.o.get_delay_ms(), 0.)
39+
40+ def test_set_delay_ms(self):
41+ val = 50.
42+ self.o.set_delay_ms(val)
43+ assert_almost_equal (self.o.get_delay_ms(), val)
44+
45+ def test_get_threshold(self):
46+ assert_almost_equal(self.o.get_threshold(), 0.3)
47+
48+ def test_set_threshold(self):
49+ val = .1
50+ self.o.set_threshold(val)
51+ assert_almost_equal (self.o.get_threshold(), val)
52+
53+ def test_get_silence(self):
54+ self.assertEqual(self.o.get_silence(), -90.)
55+
56+ def test_set_silence(self):
57+ val = -50.
58+ self.o.set_silence(val)
59+ assert_almost_equal (self.o.get_silence(), val)
60+
61+ def test_get_last(self):
62+ self.assertEqual(self.o.get_last(), 0.)
63+
64+ def test_get_last_s(self):
65+ self.assertEqual(self.o.get_last_s(), 0.)
66+
67+ def test_get_last_ms(self):
68+ self.assertEqual(self.o.get_last_ms(), 0.)
69+
70+ def test_get_period(self):
71+ self.assertEqual(self.o.get_period(), 0.)
72+
73+ def test_get_period_s(self):
74+ self.assertEqual(self.o.get_period_s(), 0.)
75+
76+ def test_get_last_tatum(self):
77+ self.assertEqual(self.o.get_last_tatum(), 0.)
78+
79+ def test_set_tatum_signature(self):
80+ self.o.set_tatum_signature(8)
81+ self.o.set_tatum_signature(64)
82+ self.o.set_tatum_signature(1)
83+
84+ def test_set_wrong_tatum_signature(self):
85+ with self.assertRaises(ValueError):
86+ self.o.set_tatum_signature(101)
87+ with self.assertRaises(ValueError):
88+ self.o.set_tatum_signature(0)
89+
90+if __name__ == '__main__':
91+ main()

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