class AbstractSourceTest(unittest.TestCase): def setUp(self): self.s = AbstractSource() self.s1 = AbstractSource(length=100) def test_params(self): self.assertEqual(self.s.channels, 1) self.assertEqual(self.s.rate, 44100) self.assertEqual(self.s.depth, 4) self.assertTrue(self.s.endless) self.assertTrue(not self.s1.endless) def test_read(self): for i, x in enumerate(self.s.read()): self.assertEqual(x, [0.0]) if i > 100: break chunk = list(self.s1.read()) self.assertEqual(chunk, [[0.0]] * 100)
def setUp(self): self.s = AbstractSource() self.s1 = AbstractSource(length=100)