Beispiel #1
0
 def test_wav_iter(self):
     i = 0
     shouldbe = [WavFile, WavFile, Silence, WavFile,
                 Silence, WavFile, Silence, WavFile]
     for x in wav_iter(self.left):
         self.assertIsInstance(x, shouldbe[i])
         i += 1
Beispiel #2
0
 def test_wav_iter(self):
     i = 0
     shouldbe = [
         WavFile, WavFile, Silence, WavFile, Silence, WavFile, Silence,
         WavFile
     ]
     for x in wav_iter(self.left):
         self.assertIsInstance(x, shouldbe[i])
         i += 1
Beispiel #3
0
    def test_merge(self):
        merge(self.left, self.lname)
        self.assertTrue(os.path.isfile(self.lname))

        # Ensure silence was inserted
        no_silence = reduce(
            lambda x, y: x + y, [wav.length() for wav in self.left])
        with_silence = reduce(
            lambda x, y: x + y, [wav.length() for wav in wav_iter(self.left)])
        self.assertEqual(no_silence, 33)
        self.assertEqual(with_silence, 38)

        merge(self.right, self.rname)
        self.assertTrue(os.path.isfile(self.rname))

        # Right channel test audio is identical to the left with no breaks.
        rlen = reduce(lambda x, y: x + y, [wav.length() for wav in self.right])
        self.assertEqual(no_silence, rlen)
Beispiel #4
0
    def test_merge(self):
        merge(self.left, self.lname)
        self.assertTrue(os.path.isfile(self.lname))

        # Ensure silence was inserted
        no_silence = reduce(lambda x, y: x + y,
                            [wav.length() for wav in self.left])
        with_silence = reduce(lambda x, y: x + y,
                              [wav.length() for wav in wav_iter(self.left)])
        self.assertEqual(no_silence, 33)
        self.assertEqual(with_silence, 38)

        merge(self.right, self.rname)
        self.assertTrue(os.path.isfile(self.rname))

        # Right channel test audio is identical to the left with no breaks.
        rlen = reduce(lambda x, y: x + y, [wav.length() for wav in self.right])
        self.assertEqual(no_silence, rlen)