def test_libritts(self): dataset = LIBRITTS(self.root_dir) n_ites = 0 for i, (waveform, sample_rate, original_text, normalized_text, speaker_id, chapter_id, utterance_id) in enumerate(dataset): expected_ids = self.utterance_ids[i] expected_data = self.data[i] self.assertEqual(expected_data, waveform, atol=5e-5, rtol=1e-8) assert sample_rate == 8000 assert speaker_id == expected_ids[0] assert chapter_id == expected_ids[1] assert original_text == self.original_text assert normalized_text == self.normalized_text assert utterance_id == f'{"_".join(str(u) for u in expected_ids[-4:])}' n_ites += 1 assert n_ites == len(self.utterance_ids)
def test_libritts_path(self): dataset = LIBRITTS(Path(self.root_dir)) self._test_libritts(dataset)
def test_libritts_str(self): dataset = LIBRITTS(self.root_dir) self._test_libritts(dataset)