def test_diff(self): timer = utility.Timer() time.sleep(0.1) self.assertAlmostEqual(timer.diff(), 0.1, places=2) time.sleep(0.2) self.assertAlmostEqual(timer.diff(), 0.2, places=1) self.assertAlmostEqual(timer.elapsed_time(), 0.3, places=2)
def test_timer(self): timer = utility.Timer() time.sleep(0.1) assert timer.elapsed_time() > 0 assert isinstance(timer.elapsedTime(format='long'), basestring) timer.reset()