def test_durationToStr(self): m = Media(self.url, self.size, self.type, timedelta(hours=1)) self.assertEqual(m.duration_str, "01:00:00") m.duration = timedelta(days=1) self.assertEqual(m.duration_str, "24:00:00") m.duration = timedelta(minutes=1) self.assertEqual(m.duration_str, "01:00") m.duration = timedelta(seconds=1) self.assertEqual(m.duration_str, "00:01") m.duration = timedelta(days=1, hours=2) self.assertEqual(m.duration_str, "26:00:00") m.duration = timedelta(hours=1, minutes=32, seconds=13) self.assertEqual(m.duration_str, "01:32:13") m.duration = timedelta(hours=1, minutes=9, seconds=3) self.assertEqual(m.duration_str, "01:09:03")
def test_assigningDuration(self): m = Media(self.url, self.size, self.type, self.duration) another_duration = timedelta(hours=0, minutes=32, seconds=23) m.duration = another_duration self.assertEqual(m.duration, another_duration)