History

python/tests/test_source.py: remove fragile brownnoise test, check duration on short files

Paul Brossier committed 9 years ago

Commit 8a49bb91 parent 261836d1 file · +8 −5Browse files

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

Unified · Split

python/tests/test_source.py+8−5
@@ -56,8 +56,6 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 55 unmodified lines
56 total_frames += read56 total_frames += read
57 if read < f.hop_size:57 if read < f.hop_size:
58 assert_equal(samples[read:], 0)58 assert_equal(samples[read:], 0)
59 if 'brownnoise' in f.uri:
60 self.assertEquals(np.count_nonzero(samples[:read]), read)
61 break59 break
62 #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}"60 #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}"
63 #result_params = total_frames / float(f.samplerate), total_frames, total_frames//f.hop_size, f.samplerate, f.uri61 #result_params = total_frames / float(f.samplerate), total_frames, total_frames//f.hop_size, f.samplerate, f.uri
@@ -71,7 +69,14 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 7 unmodified lines
71 except RuntimeError as e:69 except RuntimeError as e:
72 self.skipTest('failed opening with hop_s = {:d}, samplerate = {:d} ({:s})'.format(hop_size, samplerate, str(e)))70 self.skipTest('failed opening with hop_s = {:d}, samplerate = {:d} ({:s})'.format(hop_size, samplerate, str(e)))
73 assert f.samplerate != 071 assert f.samplerate != 0
74 self.read_from_source(f)72 read_frames = self.read_from_source(f)
73 if 'f_' in soundfile and samplerate == 0:
74 import re
75 f = re.compile('.*_\([0:9]*f\)_.*')
76 match_f = re.findall('([0-9]*)f_', soundfile)
77 if len(match_f) == 1:
78 expected_frames = int(match_f[0])
79 self.assertEqual(expected_frames, read_frames)
75 80
76 @params(*list_of_sounds)81 @params(*list_of_sounds)
77 def test_samplerate_none(self, p):82 def test_samplerate_none(self, p):
@@ -158,8 +163,6 @@ class aubio_source_readmulti_test_case(aubio_source_read_test_case): · 80 unmodified lines
158 total_frames += read163 total_frames += read
159 if read < f.hop_size:164 if read < f.hop_size:
160 assert_equal(samples[:,read:], 0)165 assert_equal(samples[:,read:], 0)
161 if 'brownnoise' in f.uri:
162 self.assertEquals(np.count_nonzero(samples[:,:read]), read)
163 break166 break
164 #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}"167 #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}"
165 #result_params = total_frames / float(f.samplerate), total_frames, f.channels, int(total_frames/f.hop_size), f.samplerate, f.uri168 #result_params = total_frames / float(f.samplerate), total_frames, f.channels, int(total_frames/f.hop_size), f.samplerate, f.uri

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