예제 #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)
예제 #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)
예제 #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)))
예제 #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)
예제 #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)
예제 #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)))
예제 #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)
예제 #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)