Beispiel #1
0
 def test_add(self):
     first = Timecode(300)
     second = Timecode(200)
     the_sum = first + second
     
     self.assertEqual(the_sum, Timecode(500))
     self.assertIsNot(the_sum, first)
     self.assertIsNot(the_sum, second)
Beispiel #2
0
 def test_sub(self):
     first = Timecode(400)
     second = Timecode(300)
     
     first_sub = first - second
     second_sub = second - first
     
     self.assertEqual(first_sub, Timecode(100))
     self.assertEqual(second_sub, Timecode(-100))
     
     self.assertIsNot(second_sub, first)
     self.assertIsNot(second_sub, second)
     self.assertIsNot(first_sub, first)
     self.assertIsNot(first_sub, second)
Beispiel #3
0
 def test_to_string(self):
     to_string_tests = [
         (1, '00:00:00,001'),
         (-2001, '-00:00:02,001'),
         (63001, '00:01:03,001'),
         (7384005, '02:03:04,005')
     ]
     
     for test, expected in to_string_tests:
         foo = Timecode(test)
         self.assertEqual(str(foo), expected, 'str(Timecode(%d)) not %s!' % (test, expected))
Beispiel #4
0
 def test_lt(self):
     first = Timecode(300)
     second = Timecode(200)
     
     self.assertFalse(first < second)
     self.assertTrue(second < first)
Beispiel #5
0
 def test_equals(self):
     first = Timecode(500)
     second = Timecode(500)
     self.assertEqual(first, second)
Beispiel #6
0
 def test_copy(self):
     first = Timecode(500)
     second = first.copy()
     self.assertEqual(first.milliseconds(), second.milliseconds())
     self.assertIsNot(first, second)