From 39be048822481198240101b6a4052d570833dc24 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 27 Feb 2017 01:59:39 +0100 Subject: [PATCH] python/tests/test_source.py: test with interface (PEP 343) --- python/tests/test_source.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/tests/test_source.py b/python/tests/test_source.py index 467290f4..755c01ed 100755 --- a/python/tests/test_source.py +++ b/python/tests/test_source.py @@ -169,5 +169,21 @@ class aubio_source_readmulti_test_case(aubio_source_read_test_case): #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() -- 2.11.0