def test_time_delta_from_string(self): self.assertEqual(timedelta(hours=0, minutes=1, seconds=13, milliseconds=464), LineParser.get_timedelta_from_string('00:01:13,464'))
def test_parser_returns_same_line_when_time_interval_incorrectly_formatted(self): invalid_line = '00:01:13,464 --> 00:01:17' self.assertEqual('00:01:13,464 --> 00:01:17', LineParser.parse(invalid_line)) invalid_line = '00:01:13 --> x:00:01:17,464' self.assertEqual(invalid_line, LineParser.parse(invalid_line))
def test_parser_returns_a_subtitle_delta_when_given_correctly_formed_time_interval(self): self.assertEquals(LineParser.parse('00:01:13,464 --> 00:01:17,696'), SubtitleDelta(timedelta(hours=0, minutes=1, seconds=13, milliseconds=464), timedelta(hours=0, minutes=1, seconds=17, milliseconds=696)))
def test_parser_returns_same_line_given_if_not_matched_time_interval(self): invalid_line = 'Fear not, l will take this to your family' self.assertEqual('Fear not, l will take this to your family', LineParser.parse(invalid_line))