Exemple #1
0
    def test_without_cooldown_time(self):
        """If no cooldown_time is specified, there's no sleep, and exactly the
        same time is returned."""

        goal_seconds = 0.01
        body = SimpleLoop(3)

        no_cooldown_loop = LoopTuner(body, goal_seconds, cooldown_time=None)
        old_time = time.time()

        new_time = no_cooldown_loop._coolDown(old_time)

        self.assertEqual(new_time, old_time)
    def test_without_cooldown_time(self):
        """If no cooldown_time is specified, there's no sleep, and exactly the
        same time is returned."""

        goal_seconds = 0.01
        body = SimpleLoop(3)

        no_cooldown_loop = LoopTuner(body, goal_seconds, cooldown_time=None)
        old_time = time.time()

        new_time = no_cooldown_loop._coolDown(old_time)

        self.assertEqual(new_time, old_time)
Exemple #3
0
    def test_cooldown_bedtime(self):
        """A private _coolDown method on LoopTuner sleeps for cooldown_time,
        and returns time after sleep is done."""

        goal_seconds = 0.01
        body = SimpleLoop(3)

        cooldown_loop = LoopTuner(body, goal_seconds, cooldown_time=0.2)
        old_time = time.time()

        new_time = cooldown_loop._coolDown(old_time)

        self.assertTrue(new_time > old_time)
    def test_cooldown_bedtime(self):
        """A private _coolDown method on LoopTuner sleeps for cooldown_time,
        and returns time after sleep is done."""

        goal_seconds = 0.01
        body = SimpleLoop(3)

        cooldown_loop = LoopTuner(body, goal_seconds, cooldown_time=0.2)
        old_time = time.time()

        new_time = cooldown_loop._coolDown(old_time)

        self.assertTrue(new_time > old_time)