def test_ok_from_file(self): filepath = os.path.join(data_path, "en.srt") filedata = open(filepath).read() d = list(srt_to_document(filedata)) self.assertEqual(len(d), 4) for sentence in d: self.assertIsInstance(sentence, Sentence) for word in sentence: self.assertIsInstance(word, unicode) self.assertNotIn("<i>", word)
def test_empty_string(self): d = list(srt_to_document("")) self.assertEqual(d, [])