Ejemplo n.º 1
0
    def test_round_time_relative(self):
        self.assertEqual(utils.round_time(1, 5, 3), 3)
        self.assertEqual(utils.round_time(2, 5, 3), 3)
        self.assertEqual(utils.round_time(3, 5, 3), 3)
        self.assertEqual(utils.round_time(5, 5, 3), 3)
        self.assertEqual(utils.round_time(6, 5, 3), 8)
        self.assertEqual(utils.round_time(7, 5, 3), 8)
        self.assertEqual(utils.round_time(8, 5, 3), 8)
        self.assertEqual(utils.round_time(9, 5, 3), 8)
        self.assertEqual(utils.round_time(10, 5, 3), 8)
        self.assertEqual(utils.round_time(11, 5, 3), 13)
        self.assertEqual(utils.round_time(13, 5, 3), 13)
        self.assertEqual(utils.round_time(14, 5, 3), 13)

        self.assertEqual(utils.round_time(1, 5, 18), 3)
        self.assertEqual(utils.round_time(2, 5, 18), 3)
        self.assertEqual(utils.round_time(3, 5, 18), 3)
        self.assertEqual(utils.round_time(5, 5, 18), 3)
        self.assertEqual(utils.round_time(6, 5, 18), 8)
        self.assertEqual(utils.round_time(7, 5, 18), 8)
        self.assertEqual(utils.round_time(8, 5, 18), 8)
        self.assertEqual(utils.round_time(9, 5, 18), 8)
        self.assertEqual(utils.round_time(10, 5, 18), 8)
        self.assertEqual(utils.round_time(11, 5, 18), 13)
        self.assertEqual(utils.round_time(13, 5, 18), 13)
        self.assertEqual(utils.round_time(14, 5, 18), 13)
Ejemplo n.º 2
0
    def test_round_time(self):
        self.assertEqual(utils.round_time(2, 5), 0)
        self.assertEqual(utils.round_time(3, 5), 5)
        self.assertEqual(utils.round_time(5, 5), 5)
        self.assertEqual(utils.round_time(6, 5), 5)
        self.assertEqual(utils.round_time(7, 5), 5)
        self.assertEqual(utils.round_time(8, 5), 10)
        self.assertEqual(utils.round_time(9, 5), 10)
        self.assertEqual(utils.round_time(10, 5), 10)

        self.assertEqual(utils.round_time(3, 10), 0)
        self.assertEqual(utils.round_time(5, 10), 10)
        self.assertEqual(utils.round_time(10, 10), 10)
        self.assertEqual(utils.round_time(12, 10), 10)
        self.assertEqual(utils.round_time(13, 10), 10)
        self.assertEqual(utils.round_time(15, 10), 20)
        self.assertEqual(utils.round_time(18, 10), 20)