ref: 39be048822481198240101b6a4052d570833dc24
parent: 25d58dc6aeb217a0bc7668613143db734052a929
author: Paul Brossier <piem@piem.org>
date: Sun Feb 26 20:59:39 EST 2017
python/tests/test_source.py: test with interface (PEP 343)
--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -169,5 +169,21 @@
#print (result_str.format(*result_params))
return total_frames
+class aubio_source_with(aubio_source_test_case_base):
+
+ #@params(*list_of_sounds)
+ @params(*list_of_sounds)
+ def test_read_from_mono(self, filename):
+ total_frames = 0
+ hop_size = 2048
+ with source(filename, 0, hop_size) as input_source:
+ assert_equal(input_source.hop_size, hop_size)
+ #assert_equal(input_source.samplerate, samplerate)
+ total_frames = 0
+ for frames in input_source:
+ total_frames += frames.shape[-1]
+ # check we read as many samples as we expected
+ assert_equal(total_frames, input_source.duration)
+
if __name__ == '__main__':
main()