From 28141901a453f299604b24ede06068328eed2b8c Mon Sep 17 00:00:00 2001 From: Daisuke Oyama Date: Fri, 25 Aug 2017 12:20:55 +0900 Subject: [PATCH] FIX: Use relative tolerance in test_tic_tac_toc (#328) --- quantecon/util/tests/test_timing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quantecon/util/tests/test_timing.py b/quantecon/util/tests/test_timing.py index e66a5428d..e841a35f3 100644 --- a/quantecon/util/tests/test_timing.py +++ b/quantecon/util/tests/test_timing.py @@ -3,6 +3,8 @@ Authors: Pablo Winant Tests for timing.py """ +from numpy.testing import assert_allclose + def test_tic_tac_toc(): @@ -22,9 +24,9 @@ def test_tic_tac_toc(): time.sleep(h) el3 = toc() - assert(abs(el1-h)<0.01) - assert(abs(el2-h)<0.01) - assert(abs(el3-h*3)<0.01) + rtol = 0.1 + for actual, desired in zip([el1, el2, el3], [h, h, h*3]): + assert_allclose(actual, desired, rtol=rtol) if __name__ == "__main__":