From 7869bd09c3d440fc0b5f8675a7089223b43a18c1 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 10 Oct 2012 18:25:26 +0000 Subject: [PATCH] [Cython] Fixed implementation of absolute error tolerances in unit tests --- interfaces/cython/cantera/test/utilities.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/test/utilities.py b/interfaces/cython/cantera/test/utilities.py index f507eb298..fa0d391fc 100644 --- a/interfaces/cython/cantera/test/utilities.py +++ b/interfaces/cython/cantera/test/utilities.py @@ -1,9 +1,10 @@ import numpy as np import unittest + class CanteraTest(unittest.TestCase): def assertNear(self, a, b, rtol=1e-8, atol=1e-12, msg=None): - cmp = 2 * abs(a - b)/(abs(a) + abs(b) + atol) + cmp = 2 * abs(a - b)/(abs(a) + abs(b) + 2 * atol / rtol) if cmp > rtol: message = ('AssertNear: %.14g - %.14g = %.14g\n' % (a, b, a-b) + 'Relative error of %10e exceeds rtol = %10e' % (cmp, rtol))