History

python/tests/test_sink.py: add more tests, quiet warnings

Paul Brossier committed 9 years ago

Commit fa6373c1 parent a1bf01d1 file · +23 −0Browse files

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

Unified · Split

python/tests/test_sink.py+23−0
@@ -6,6 +6,9 @@ from numpy.testing import TestCase · 5 unmodified lines
6from aubio import fvec, source, sink6from aubio import fvec, source, sink
7from .utils import list_all_sounds, get_tmp_sink_path, del_tmp_sink_path7from .utils import list_all_sounds, get_tmp_sink_path, del_tmp_sink_path
8 8
9import warnings
10warnings.filterwarnings('ignore', category=UserWarning, append=True)
11
9list_of_sounds = list_all_sounds('sounds')12list_of_sounds = list_all_sounds('sounds')
10samplerates = [0, 44100, 8000, 32000]13samplerates = [0, 44100, 8000, 32000]
11hop_sizes = [512, 1024, 64]14hop_sizes = [512, 1024, 64]
@@ -26,6 +29,26 @@ class aubio_sink_test_case(TestCase): · 14 unmodified lines
26 if not len(list_of_sounds):29 if not len(list_of_sounds):
27 self.skipTest('add some sound files in \'python/tests/sounds\'')30 self.skipTest('add some sound files in \'python/tests/sounds\'')
28 31
32 def test_wrong_filename(self):
33 with self.assertRaises(RuntimeError):
34 sink('')
35
36 def test_wrong_samplerate(self):
37 with self.assertRaises(RuntimeError):
38 sink(get_tmp_sink_path(), -1)
39
40 def test_wrong_samplerate_too_large(self):
41 with self.assertRaises(RuntimeError):
42 sink(get_tmp_sink_path(), 1536001, 2)
43
44 def test_wrong_channels(self):
45 with self.assertRaises(RuntimeError):
46 sink(get_tmp_sink_path(), 44100, -1)
47
48 def test_wrong_channels_too_large(self):
49 with self.assertRaises(RuntimeError):
50 sink(get_tmp_sink_path(), 44100, 202020)
51
29 def test_many_sinks(self):52 def test_many_sinks(self):
30 from tempfile import mkdtemp53 from tempfile import mkdtemp
31 import os.path54 import os.path

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