From 4949182431ddff0950150f838a536400d091f890 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 31 Jan 2014 18:14:26 -0300 Subject: [PATCH] python/tests/test_{source,sink}.py: add close() tests --- python/tests/test_sink.py | 11 +++++++++++ python/tests/test_source.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+) 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() -- 2.11.0