shithub: aubio

Download patch

ref: 4949182431ddff0950150f838a536400d091f890
parent: 2e17371f6553838cf7b19bb23b92493644151916
author: Paul Brossier <[email protected]>
date: Fri Jan 31 13:14:26 EST 2014

python/tests/test_{source,sink}.py: add close() tests

--- a/python/tests/test_sink.py
+++ b/python/tests/test_sink.py
@@ -41,6 +41,17 @@
                 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()
--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -68,6 +68,21 @@
             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()