shithub: aubio

Download patch

ref: 87971384c0c84945758c285001a5bd21bae2c171
parent: 37c7e61a5ed40454aabbbcb04c4a334caad04823
author: Paul Brossier <piem@piem.org>
date: Fri Dec 21 11:22:27 EST 2018

[tests] check reading source after close raises RuntimeError

--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -40,6 +40,19 @@
         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):