From: Paul Brossier Date: Fri, 31 Jan 2014 21:14:26 +0000 (-0300) Subject: python/tests/test_{source,sink}.py: add close() tests X-Git-Tag: 0.4.1~60 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=4949182431ddff0950150f838a536400d091f890;p=aubio.git python/tests/test_{source,sink}.py: add close() tests --- diff --git a/python/tests/test_sink.py b/python/tests/test_sink.py index 033ba546..ffa83845 100755 --- a/python/tests/test_sink.py +++ b/python/tests/test_sink.py @@ -41,6 +41,17 @@ class aubio_sink_test_case(TestCase): print "to", g.uri #del f, g + def test_close_file(self): + samplerate = 44100 + g = sink('/tmp/f.wav', samplerate) + g.close() + + def test_close_file_twice(self): + samplerate = 44100 + g = sink('/tmp/f.wav', samplerate) + g.close() + g.close() + if __name__ == '__main__': from unittest import main main() diff --git a/python/tests/test_source.py b/python/tests/test_source.py index b96bb919..86607be4 100755 --- a/python/tests/test_source.py +++ b/python/tests/test_source.py @@ -68,6 +68,21 @@ class aubio_source_test_case(TestCase): assert f.hop_size != 0 self.read_from_sink(f) + def test_close_file(self): + samplerate = 0 # use native samplerate + hop_size = 256 + for p in list_of_sounds: + f = source(p, samplerate, hop_size) + f.close() + + def test_close_file_twice(self): + samplerate = 0 # use native samplerate + hop_size = 256 + for p in list_of_sounds: + f = source(p, samplerate, hop_size) + f.close() + f.close() + if __name__ == '__main__': from unittest import main main()