def test_output(self): tic() time.sleep(self.h) tm1 = tac(self.digits, True, False) time.sleep(self.h) tm2 = tac(self.digits, True, False) time.sleep(self.h) tm3 = toc(self.digits, True, False) eq_(tm1, None) eq_(tm2, None) eq_(tm3, None)
def test_digits(self): tic() time.sleep(self.h) tm1 = tac(self.digits) time.sleep(self.h) tm2 = tac(self.digits) time.sleep(self.h) tm3 = toc(self.digits) eq_(len(str(tm1).split(".")[1]), 10) eq_(len(str(tm2).split(".")[1]), 10) eq_(len(str(tm3).split(".")[1]), 10)
def test_timer(self): tic() time.sleep(self.h) tm1 = float(tac()) time.sleep(self.h) tm2 = float(tac()) time.sleep(self.h) tm3 = float(toc()) rtol = 0.1 for actual, desired in zip([tm1, tm2, tm3], [self.h, self.h, self.h*3]): assert_allclose(actual, desired, rtol=rtol)
def test_timer(self): tic() time.sleep(self.h) tm1 = tac() time.sleep(self.h) tm2 = tac() time.sleep(self.h) tm3 = toc() rtol = 0.1 for actual, desired in zip([tm1, tm2, tm3], [self.h, self.h, self.h * 3]): assert_allclose(actual, desired, rtol=rtol)
def test_timer(self): if platform == 'darwin': # skip for darwin return tic() time.sleep(self.h) tm1 = tac() time.sleep(self.h) tm2 = tac() time.sleep(self.h) tm3 = toc() rtol = 0.1 for actual, desired in zip([tm1, tm2, tm3], [self.h, self.h, self.h * 3]): assert_allclose(actual, desired, rtol=rtol)
def test_timer(self): if platform == 'darwin': # skip for darwin return tic() time.sleep(self.h) tm1 = tac() time.sleep(self.h) tm2 = tac() time.sleep(self.h) tm3 = toc() rtol = 0.1 for actual, desired in zip([tm1, tm2, tm3], [self.h, self.h, self.h*3]): assert_allclose(actual, desired, rtol=rtol)