Esempio n. 1
0
 def test_write_to_file(self):
     events = [
         SrtEvent.from_string(SINGLE_LINE_SRT_EVENT),
         SrtEvent.from_string(MULTILINE_SRT_EVENT)
     ]
     SrtScript(events).save_to_file(self.script_path)
     with open(self.script_path) as script:
         text = script.read()
     self.assertEquals(SINGLE_LINE_SRT_EVENT + "\n\n" + MULTILINE_SRT_EVENT,
                       text)
Esempio n. 2
0
 def test_multi_line_event_parsing(self):
     event = SrtEvent.from_string(MULTILINE_SRT_EVENT)
     self.assertEquals(13 * 60 + 12.140, event.start)
     self.assertEquals(13 * 60 + 14.100, event.end)
     self.assertEquals(
         "APPEARANCE!\nAppearrance (teisai)!\nNo wait, you're the worst (saitei)!",
         event.text)
Esempio n. 3
0
 def test_parsing_and_printing(self):
     self.assertEquals(SINGLE_LINE_SRT_EVENT,
                       unicode(SrtEvent.from_string(SINGLE_LINE_SRT_EVENT)))
     self.assertEquals(MULTILINE_SRT_EVENT,
                       unicode(SrtEvent.from_string(MULTILINE_SRT_EVENT)))
Esempio n. 4
0
 def test_simple_parsing(self):
     event = SrtEvent.from_string(SINGLE_LINE_SRT_EVENT)
     self.assertEquals(14 * 60 + 21.960, event.start)
     self.assertEquals(14 * 60 + 22.960, event.end)
     self.assertEquals("HOW DID IT END UP LIKE THIS?", event.text)
Esempio n. 5
0
 def test_write_to_file(self):
     events = [SrtEvent.from_string(SINGLE_LINE_SRT_EVENT), SrtEvent.from_string(MULTILINE_SRT_EVENT)]
     SrtScript(events).save_to_file(self.script_path)
     with open(self.script_path) as script:
         text = script.read()
     self.assertEquals(SINGLE_LINE_SRT_EVENT + "\n\n" + MULTILINE_SRT_EVENT, text)
Esempio n. 6
0
 def test_parsing_and_printing(self):
     self.assertEquals(SINGLE_LINE_SRT_EVENT, unicode(SrtEvent.from_string(SINGLE_LINE_SRT_EVENT)))
     self.assertEquals(MULTILINE_SRT_EVENT, unicode(SrtEvent.from_string(MULTILINE_SRT_EVENT)))
Esempio n. 7
0
 def test_multi_line_event_parsing(self):
     event = SrtEvent.from_string(MULTILINE_SRT_EVENT)
     self.assertEquals(13*60+12.140, event.start)
     self.assertEquals(13*60+14.100, event.end)
     self.assertEquals("APPEARANCE!\nAppearrance (teisai)!\nNo wait, you're the worst (saitei)!", event.text)
Esempio n. 8
0
 def test_simple_parsing(self):
     event = SrtEvent.from_string(SINGLE_LINE_SRT_EVENT)
     self.assertEquals(14*60+21.960, event.start)
     self.assertEquals(14*60+22.960, event.end)
     self.assertEquals("HOW DID IT END UP LIKE THIS?", event.text)