+
+class aubio_source_test_wrong_params(TestCase):
+
+ def test_wrong_file(self):
+ with self.assertRaises(RuntimeError):
+ f = source('path_to/unexisting file.mp3')
+
+ def test_wrong_samplerate(self):
+ with self.assertRaises(ValueError):
+ f = source(default_test_sound, -1)
+
+ def test_wrong_hop_size(self):
+ with self.assertRaises(ValueError):
+ f = source(default_test_sound, 0, -1)
+
+ def test_wrong_channels(self):
+ with self.assertRaises(ValueError):
+ f = source(default_test_sound, 0, 0, -1)
+
+ def test_wrong_seek(self):
+ f = source(default_test_sound)
+ with self.assertRaises(ValueError):
+ f.seek(-1)
+
+ def test_wrong_seek_too_large(self):
+ f = source(default_test_sound)
+ try:
+ with self.assertRaises(ValueError):
+ f.seek(f.duration + f.samplerate * 10)
+ except AssertionError as e:
+ self.skipTest('seeking after end of stream failed raising ValueError')
+