def test_many(self):
        time = TestingTimeFunction()
        manager = TimerManager(_time_function=time)

        c5 = MockCallback()
        manager.add_timer(5, c5, repeat=True)
        c7 = MockCallback()
        manager.add_timer(7, c7, repeat=True)
        c13 = MockCallback()
        manager.add_timer(13, c13, repeat=True)
        
        nb_sleeps = 0
        while 1:
            time.time += manager.sleep_time()
            if time.time >= 100:
                break
            nb_sleeps += 1
            manager.run()
        
        assert c5.nb_calls == 19
        assert c7.nb_calls == 14
        assert c13.nb_calls == 7
        # 4 is the number of times (t = 35, 65, 70, 91) where 2 timers
        # trigger at the same time.
        assert nb_sleeps == (c5.nb_calls + c7.nb_calls + c13.nb_calls - 4)
dataset/ETHPy150Open SimonSapin/snippets/event_loop/tests.py/TestTimerManager.test_many/original