Skip to content

Commit

Permalink
Use assert_allclose
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Nov 3, 2022
1 parent 7e04417 commit b3ce842
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions quantecon/util/tests/test_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b3ce842

Please sign in to comment.