[tests] check reading source after close raises RuntimeError
authorPaul Brossier <piem@piem.org>
Fri, 21 Dec 2018 15:22:27 +0000 (16:22 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 21 Dec 2018 15:22:27 +0000 (16:22 +0100)
python/tests/test_source.py

index 6d88c62..9d2e61f 100755 (executable)
@@ -40,6 +40,19 @@ class Test_aubio_source_test_case(object):
         f.close()
         f.close()
 
+    @parametrize('filename', [default_test_sound])
+    def test_read_after_close(self, filename):
+        samplerate = 0 # use native samplerate
+        hop_size = 256
+        f = source(filename, samplerate, hop_size)
+        read, frames = f()
+        f.close()
+        with assert_raises(RuntimeError):
+            read, frames = f()
+        with assert_raises(RuntimeError):
+            read, frames = f.do_multi()
+
+
 class Test_aubio_source_read(object):
 
     def read_from_source(self, f):