Index: python/tests/test_sink.py
===================================================================
--- python/tests/test_sink.py	(revision e1bfde5b4ebe6465f95565b3f3ba978db22bbf30)
+++ python/tests/test_sink.py	(revision e1bfde5b4ebe6465f95565b3f3ba978db22bbf30)
@@ -0,0 +1,37 @@
+#! /usr/bin/env python
+
+from numpy.testing import TestCase, assert_equal, assert_almost_equal
+from aubio import fvec, source, sink
+from numpy import array
+from utils import list_all_sounds
+
+list_of_sounds = list_all_sounds('sounds')
+path = None
+
+class aubio_sink_test_case(TestCase):
+
+    def setUp(self):
+        if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'')
+
+    def test_read(self):
+        for path in list_of_sounds:
+            for samplerate, hop_size in zip([0, 44100, 8000, 32000], [512, 1024, 64, 256]):
+                f = source(path, samplerate, hop_size)
+                if samplerate == 0: samplerate = f.samplerate
+                g = sink('/tmp/f.wav', samplerate)
+                total_frames = 0
+                while True:
+                    vec, read = f()
+                    #print g(vec, read)
+                    total_frames += read
+                    if read < f.hop_size: break
+                print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
+                print "(", total_frames, "frames", "in",
+                print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
+                print "from", f.uri,
+                print "to", g.uri
+
+if __name__ == '__main__':
+  from unittest import main
+  main()
+
Index: python/tests/test_source.py
===================================================================
--- python/tests/test_source.py	(revision 143cc436f4a9003e01c202a41fd63d1d07649235)
+++ python/tests/test_source.py	(revision e1bfde5b4ebe6465f95565b3f3ba978db22bbf30)
@@ -4,24 +4,66 @@
 from aubio import fvec, source
 from numpy import array
+from utils import list_all_sounds
 
-path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"
+list_of_sounds = list_all_sounds('sounds')
+path = None
 
-class aubio_filter_test_case(TestCase):
+class aubio_source_test_case(TestCase):
 
-  def test_members(self):
-    f = source(path)
-    print dir(f)
+    def setUp(self):
+        if not len(list_of_sounds): self.skipTest('add some sound files in \'python/tests/sounds\'')
 
-  def test_read(self):
-    f = source(path)
-    total_frames = 0
-    while True:
-      vec, read = f()
-      total_frames += read
-      if read < f.hop_size: break
-    print "read", total_frames / float(f.samplerate), " seconds from", path
+    def read_from_sink(self, f):
+        total_frames = 0
+        while True:
+            vec, read = f()
+            total_frames += read
+            if read < f.hop_size: break
+        print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
+        print "(", total_frames, "frames", "in",
+        print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
+        print "from", f.uri
+
+    def test_samplerate_hopsize(self):
+        for p in list_of_sounds:
+            for samplerate, hop_size in zip([0, 44100, 8000, 32000], [ 512, 512, 64, 256]):
+                f = source(p, samplerate, hop_size)
+                assert f.samplerate != 0
+                self.read_from_sink(f)
+
+    def test_samplerate_none(self):
+        for p in list_of_sounds:
+            f = source(p)
+            assert f.samplerate != 0
+            self.read_from_sink(f)
+
+    def test_samplerate_0(self):
+        for p in list_of_sounds:
+            f = source(p, 0)
+            assert f.samplerate != 0
+            self.read_from_sink(f)
+
+    def test_wrong_samplerate(self):
+        for p in list_of_sounds:
+            try:
+                f = source(p, -1)
+            except Exception, e:
+                print e
+            else:
+                self.fail('does not fail with wrong samplerate')
+
+    def test_wrong_hop_size(self):
+        for p in list_of_sounds:
+            f = source(p, 0, -1)
+            print f.hop_size
+
+    def test_zero_hop_size(self):
+        for p in list_of_sounds:
+            f = source(p, 0, 0)
+            assert f.samplerate != 0
+            assert f.hop_size != 0
+            self.read_from_sink(f)
 
 if __name__ == '__main__':
-  from unittest import main
-  main()
-
+    from unittest import main
+    main()
Index: python/tests/utils.py
===================================================================
--- python/tests/utils.py	(revision 143cc436f4a9003e01c202a41fd63d1d07649235)
+++ python/tests/utils.py	(revision e1bfde5b4ebe6465f95565b3f3ba978db22bbf30)
@@ -2,8 +2,12 @@
 
 def array_from_text_file(filename, dtype = 'float'):
-  import os.path
-  from numpy import array
-  filename = os.path.join(os.path.dirname(__file__), filename)
-  return array([line.split() for line in open(filename).readlines()], 
-      dtype = dtype)
+    import os.path
+    from numpy import array
+    filename = os.path.join(os.path.dirname(__file__), filename)
+    return array([line.split() for line in open(filename).readlines()],
+        dtype = dtype)
 
+def list_all_sounds(rel_dir):
+    import os.path, glob
+    datadir = os.path.join(os.path.dirname(__file__), rel_dir)
+    return glob.glob(os.path.join(datadir,'*.*'))
