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
5656 total_frames += read
5757 if read < f.hop_size:
5858 assert_equal(samples[read:], 0)
59− if 'brownnoise' in f.uri:
60− self.assertEquals(np.count_nonzero(samples[:read]), read)
6159 break
6260 #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}"
6361 #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
7169 except RuntimeError as e:
7270 self.skipTest('failed opening with hop_s = {:d}, samplerate = {:d} ({:s})'.format(hop_size, samplerate, str(e)))
7371 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)
7580
7681 @params(*list_of_sounds)
7782 def test_samplerate_none(self, p):
@@ -158,8 +163,6 @@ class aubio_source_readmulti_test_case(aubio_source_read_test_case): · 80 unmodified lines
158163 total_frames += read
159164 if read < f.hop_size:
160165 assert_equal(samples[:,read:], 0)
161− if 'brownnoise' in f.uri:
162− self.assertEquals(np.count_nonzero(samples[:,:read]), read)
163166 break
164167 #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}"
165168 #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