예제 #1
0
 def test_bad_values(self):
     with self.assertRaises(TypeError):
         util.UpDownTime("a", 2, 3, 4)
     with self.assertRaises(TypeError):
         util.UpDownTime(1, "a", 3, 4)
     with self.assertRaises(TypeError):
         util.UpDownTime(1, 2, "a", 4)
     with self.assertRaises(TypeError):
         util.UpDownTime(1, 2, 3, "a")
예제 #2
0
    def test_false_compare(self):
        u1 = util.UpDownTime(1, 2, 3, 4)
        u2 = util.UpDownTime(1, 2, 3, 5)
        self.assertNotEqual(u1, u2)

        u2 = util.UpDownTime(1, 2, 4, 4)
        self.assertNotEqual(u1, u2)

        u2 = util.UpDownTime(1, 3, 3, 4)
        self.assertNotEqual(u1, u2)

        u2 = util.UpDownTime(2, 2, 3, 4)
        self.assertNotEqual(u1, u2)
예제 #3
0
 def test_bad_compare(self):
     u = util.UpDownTime(1, 2, 3, 4)
     self.assertFalse(u == "a")
예제 #4
0
 def test_str(self):
     u1 = util.UpDownTime(1, 2, 3, 4)
     self.assertEqual(str(u1), "1+02:03:04")
예제 #5
0
 def test_equal(self):
     u1 = util.UpDownTime(1, 2, 3, 4)
     u2 = util.UpDownTime(1, 2, 3, 4)
     self.assertEqual(u1, u2)
예제 #6
0
 def test_givenInit(self):
     u = util.UpDownTime(1, 2, 3, 4)
     self.assertEqual(1, u.days, "days not inited to 1")
     self.assertEqual(2, u.hours, "hours not inited to 2")
     self.assertEqual(3, u.minutes, "minutes not inited to 3")
     self.assertEqual(4, u.seconds, "seconds not inited to 4")
예제 #7
0
 def test_blankInit(self):
     u = util.UpDownTime()
     self.assertEqual(0, u.days, "days not defaulted to 0")
     self.assertEqual(0, u.hours, "hours not defaulted to 0")
     self.assertEqual(0, u.minutes, "minutes not defaulted to 0")
     self.assertEqual(0, u.seconds, "seconds not defaulted to 0")