def check_parsing(self, content, correct_subs): subtitles = TXTParser.parse(content).to_internal().subtitle_items( mappings=TXTGenerator.MAPPINGS) self.assertEqual([s.text for s in subtitles], correct_subs) for sub in subtitles: self.assertEqual(sub.start_time, None) self.assertEqual(sub.end_time, None)
def test_linebreaks(self): input_str = '''hey hey2 hey3 second line''' subs = TXTParser.parse(input_str) self.assertEqual(len(subs), 2)
def test_basic(self): subs = TXTParser.parse(TXT_TEXT.encode('utf-8')) self.assertEquals(len(subs), 2) [x for x in subs.to_internal().subtitle_items()]