[cig-commits] r20998 - short/3D/PyLith/branches/v1.8-stable/tests_auto/eqinfo

brad at geodynamics.org brad at geodynamics.org
Tue Nov 6 23:06:50 PST 2012


Author: brad
Date: 2012-11-06 23:06:50 -0800 (Tue, 06 Nov 2012)
New Revision: 20998

Modified:
   short/3D/PyLith/branches/v1.8-stable/tests_auto/eqinfo/TestEqInfo.py
Log:
Fix assert check to be compatible with Python 2.4+.

Modified: short/3D/PyLith/branches/v1.8-stable/tests_auto/eqinfo/TestEqInfo.py
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/tests_auto/eqinfo/TestEqInfo.py	2012-11-07 06:27:29 UTC (rev 20997)
+++ short/3D/PyLith/branches/v1.8-stable/tests_auto/eqinfo/TestEqInfo.py	2012-11-07 07:06:50 UTC (rev 20998)
@@ -22,6 +22,7 @@
 
 import unittest
 import numpy
+import math
 
 class TestEqInfo(unittest.TestCase):
   """
@@ -52,7 +53,10 @@
       for (valueE, value) in zip(valuesE, values):
         msg = "Mismatch in value for attribute '%s', %g != %g." % (attr, valueE, value)
         if valueE != 0.0:
-          self.assertAlmostEqual(1.0, value/valueE, places=6, msg=msg)
+          if math.isinf(math.fabs(valueE)):
+            self.assertAlmostEqual(1.0, math.fabs(value)/1.0e+30, places=6, msg=msg)
+          else:
+            self.assertAlmostEqual(1.0, value/valueE, places=6, msg=msg)
         else:
           self.assertAlmostEqual(valueE, value, places=6, msg=msg)
         



More information about the CIG-COMMITS mailing list