Showing the changes to python/tests (1 of 1 file). Show all
Unified · Split
| @@ -56,8 +56,6 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 55 unmodified lines | |||
| 56 | total_frames += read | 56 | 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 | break | 59 | 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.uri | 61 | #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 != 0 | 71 | 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 += read | 163 | 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 | break | 166 | 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.uri | 168 | #result_params = total_frames / float(f.samplerate), total_frames, f.channels, int(total_frames/f.hop_size), f.samplerate, f.uri |