Пример #1
0
 def test_timer_get_non_existent(self, name):
     if name == self.default_timer:
         condition = does_not_raise()
     else:
         condition = pytest.raises(IndexError)
     with condition:
         logger.get_timer(name)
Пример #2
0
 def test_timer_get_run_time_stopped(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     logger.stop_timer(name)
     timer = logger.get_timer(name)
     time.sleep(0.05)
     assert timer.stop_time - timer.start_time >= 0.01
     assert timer.stop_time - timer.start_time < 0.05
Пример #3
0
 def test_timer_get_added(self, name):
     if name != self.default_timer:
         timer = logger.Timer()
         logger.add_timer(name, timer)
     else:
         timer = logger._timers[name]
     result = logger.get_timer(name)
     assert result == timer
Пример #4
0
 def test_timer_get_run_time_running(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     timer = logger.get_timer(name)
     assert time.perf_counter() - timer.start_time >= 0.01
Пример #5
0
 def test_timer_get_stop_time(self, name):
     logger.start_timer(name)
     time.sleep(0.01)
     logger.stop_timer(name)
     timer = logger.get_timer(name)
     assert timer.stop_time <= time.perf_counter()
Пример #6
0
 def test_timer_get_created_return_type(self, name):
     if name != self.default_timer:
         logger.add_timer(name)
     timer = logger.get_timer(name)
     assert isinstance(timer, logger.Timer)
Пример #7
0
 def test_timer_get_created(self, name):
     if name != self.default_timer:
         logger.add_timer(name)
     timer = logger.get_timer(name)
     assert timer is not None
Пример #8
0
 def test_timer_get_defaults_return_type(self, name):
     timer = logger.get_timer(name)
     assert isinstance(timer, logger.Timer)
Пример #9
0
 def test_timer_get_defaults(self, name):
     timer = logger.get_timer(name)
     assert timer is not None