[Yt-svn] yt-commit r1799 - trunk/yt/extensions/enzo_test

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Tue Jul 20 10:31:03 PDT 2010


Author: mturk
Date: Tue Jul 20 10:31:03 2010
New Revision: 1799
URL: http://yt.enzotools.org/changeset/1799

Log:
Backporting ShapeMismatch from hg



Modified:
   trunk/yt/extensions/enzo_test/output_tests.py

Modified: trunk/yt/extensions/enzo_test/output_tests.py
==============================================================================
--- trunk/yt/extensions/enzo_test/output_tests.py	(original)
+++ trunk/yt/extensions/enzo_test/output_tests.py	Tue Jul 20 10:31:03 2010
@@ -29,6 +29,15 @@
         return "ArrayDelta: Delta %0.5e, max of %0.5e" % (
             self.delta, self.acceptable)
 
+class ShapeMismatch(RegressionTestException):
+    def __init__(self, old_shape, current_shape):
+        self.old_shape = old_shape
+        self.current_shape = current_shape
+
+    def __repr__(self):
+        return "Shape Mismatch: old_buffer %s, current_buffer %0.5e" % (
+            self.old_shape, self.current_shape)
+
 class RegressionTest(object):
     name = None
     result = None
@@ -79,6 +88,8 @@
         greater than `acceptable` it is considered a failure and an appropriate
         exception is raised.
         """
+        if a1.shape != a2.shape:
+            raise ShapeMismatch(a1, a2)
         delta = na.abs(a1 - a2)/(a1 + a2)
         if delta.max() > acceptable:
             raise ArrayDelta(delta, acceptable)



More information about the yt-svn mailing list