From b3ce842b3a35cfddee3285c6ff0ae244e1d0343c Mon Sep 17 00:00:00 2001 From: Smit-create Date: Thu, 3 Nov 2022 13:04:11 +0530 Subject: [PATCH] Use assert_allclose --- quantecon/util/tests/test_timing.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/quantecon/util/tests/test_timing.py b/quantecon/util/tests/test_timing.py index 7f30bd8a5..161f92687 100644 --- a/quantecon/util/tests/test_timing.py +++ b/quantecon/util/tests/test_timing.py @@ -56,14 +56,15 @@ def test_function_two_arg(n, a): test_two_arg = \ loop_timer(5, test_function_two_arg, [self.h, 1], digits=10) - tol = 0.01 + rtol = 0.1 + if platform == 'win32': # pytest platform specific issue - tol *= 2 + rtol *= 2 for tm in test_one_arg: - assert(abs(tm - self.h) < tol), tm + assert_allclose(tm, self.h, rtol=rtol) for tm in test_two_arg: - assert(abs(tm - self.h) < tol), tm + assert_allclose(tm, self.h, rtol=rtol) for (average_time, average_of_best) in [test_one_arg, test_two_arg]: assert_(average_time >= average_of_best)