def test_no_space_left(self): self.original_video.duration = 10 self.original_video.save() subs = [SubtitleLine( 2 * 1000, 10 * 1000, 'text', {}, )] subs = add_credit(self.version, self._subs_to_sset(subs)) self.assertEquals(len(subs), 1) last_sub = subs[-1] self.assertEquals(last_sub.text, 'text')
def test_straight_up_video(self): subs = [SubtitleLine( 2 * 1000, 3 * 1000, 'text', {}, )] subs = add_credit(self.version, self._subs_to_sset(subs)) last_sub = subs[-1] self.assertEquals(last_sub.text, "Subtitles by the Amara.org community") self.assertEquals(last_sub.start_time, 7000) self.assertEquals(last_sub.end_time, 10 * 1000)
def test_only_a_second_left(self): subs = [SubtitleLine( 2 * 1000, 9 * 1000, 'text', {}, )] subs = add_credit(self.version, self._subs_to_sset(subs)) last_sub = subs[-1] self.assertEquals(last_sub.text, "Subtitles by the Amara.org community") self.assertEquals(last_sub.start_time, 9000) self.assertEquals(last_sub.end_time, 10 * 1000)
def test_last_sub_not_synced(self): subs = [SubtitleLine( 2 * 1000, None, 'text', {}, )] last_sub = subs[-1] self.assertEquals(last_sub.end_time, None) subs = add_credit(self.version, self._subs_to_sset(subs)) self.assertEquals(last_sub.text, subs[-1].text)