class TestSimpleTime(unittest.TestCase): def setUp(self): self.time = WebVTTTime() def test_default_value(self): self.assertEqual(self.time.ordinal, 0) def test_micro_seconds(self): self.time.milliseconds = 1 self.assertEqual(self.time.milliseconds, 1) self.time.hours += 42 self.assertEqual(self.time.milliseconds, 1) self.time.milliseconds += 1000 self.assertEqual(self.time.seconds, 1) def test_seconds(self): self.time.seconds = 1 self.assertEqual(self.time.seconds, 1) self.time.hours += 42 self.assertEqual(self.time.seconds, 1) self.time.seconds += 60 self.assertEqual(self.time.minutes, 1) def test_minutes(self): self.time.minutes = 1 self.assertEqual(self.time.minutes, 1) self.time.hours += 42 self.assertEqual(self.time.minutes, 1) self.time.minutes += 60 self.assertEqual(self.time.hours, 43) def test_hours(self): self.time.hours = 1 self.assertEqual(self.time.hours, 1) self.time.minutes += 42 self.assertEqual(self.time.hours, 1) def test_shifting(self): self.time.shift(1, 1, 1, 1) self.assertEqual(self.time, (1, 1, 1, 1)) def test_descriptor_from_class(self): self.assertRaises(AttributeError, lambda: WebVTTTime.hours)
class TestSimpleTime(unittest.TestCase): def setUp(self): self.time = WebVTTTime() def test_default_value(self): self.assertEqual(self.time.ordinal, 0) def test_micro_seconds(self): self.time.milliseconds = 1 self.assertEqual(self.time.milliseconds, 1) self.time.hours += 42 self.assertEqual(self.time.milliseconds, 1) self.time.milliseconds += 1000 self.assertEqual(self.time.seconds, 1) def test_seconds(self): self.time.seconds = 1 self.assertEqual(self.time.seconds, 1) self.time.hours += 42 self.assertEqual(self.time.seconds, 1) self.time.seconds += 60 self.assertEqual(self.time.minutes, 1) def test_minutes(self): self.time.minutes = 1 self.assertEqual(self.time.minutes, 1) self.time.hours += 42 self.assertEqual(self.time.minutes, 1) self.time.minutes += 60 self.assertEqual(self.time.hours, 43) def test_hours(self): self.time.hours = 1 self.assertEqual(self.time.hours, 1) self.time.minutes += 42 self.assertEqual(self.time.hours, 1) def test_shifting(self): self.time.shift(1, 1, 1, 1) self.assertEqual(self.time, (1, 1, 1, 1)) def test_descriptor_from_class(self): self.assertRaises(AttributeError, lambda: WebVTTTime.hours)
class TestSimpleTime(TestCase): def setUp(self): self.time = WebVTTTime() def test_default_value(self): self.assertEqual(self.time.ordinal, 0) def test_micro_seconds(self): self.time.milliseconds = 1 self.assertEqual(self.time.milliseconds, 1) self.time.hours += 42 self.assertEqual(self.time.milliseconds, 1) self.time.milliseconds += 1000 self.assertEqual(self.time.seconds, 1) def test_seconds(self): self.time.seconds = 1 self.assertEqual(self.time.seconds, 1) self.time.hours += 42 self.assertEqual(self.time.seconds, 1) self.time.seconds += 60 self.assertEqual(self.time.minutes, 1) def test_minutes(self): self.time.minutes = 1 self.assertEqual(self.time.minutes, 1) self.time.hours += 42 self.assertEqual(self.time.minutes, 1) self.time.minutes += 60 self.assertEqual(self.time.hours, 43) def test_hours(self): self.time.hours = 1 self.assertEqual(self.time.hours, 1) self.time.minutes += 42 self.assertEqual(self.time.hours, 1) def test_shifting_forward(self): self.time.shift(1, 1, 1, 1) self.assertEqual(self.time, (1, 1, 1, 1)) def test_shifting_backwards(self): self.time.shift(-1, -1, -1, -1) self.assertEqual(self.time, (-2, 58, 58, 999)) self.time = WebVTTTime(1, 2, 3, 4) self.time.shift(-1, -1, -1, -1) self.assertEqual(self.time, (0, 1, 2, 3)) def test_descriptor_from_class(self): self.assertRaises(AttributeError, lambda: WebVTTTime.hours)