[Numpy-svn] r4977 - in trunk/numpy/testing: . tests

numpy-svn@scip... numpy-svn@scip...
Mon Apr 7 18:02:07 CDT 2008


Author: cdavid
Date: 2008-04-07 18:02:05 -0500 (Mon, 07 Apr 2008)
New Revision: 4977

Added:
   trunk/numpy/testing/tests/
   trunk/numpy/testing/tests/test_utils.py
Log:
Start testing test functions.

Added: trunk/numpy/testing/tests/test_utils.py
===================================================================
--- trunk/numpy/testing/tests/test_utils.py	2008-04-07 22:40:42 UTC (rev 4976)
+++ trunk/numpy/testing/tests/test_utils.py	2008-04-07 23:02:05 UTC (rev 4977)
@@ -0,0 +1,30 @@
+import numpy as N
+from numpy.testing.utils import *
+
+class TestEqual:
+    def _test_equal(self, a, b):
+        assert_array_equal(a, b)
+
+    def _test_not_equal(self, a, b):
+        passed = False
+        try:
+            assert_array_equal(a, b)
+            passed = True
+        except AssertionError:
+            pass
+
+        if passed:
+            raise AssertionError("a and b are found equal but are not")
+
+    def test_array_rank1_eq(self):
+        """Test two equal array are found equal."""
+        a = N.array([1, 2])
+        b = N.array([1, 2])
+
+        self._test_equal(a, b)
+
+    def test_array_rank1_noteq(self):
+        a = N.array([1, 2])
+        b = N.array([2, 2])
+
+        self._test_not_equal(a, b)



More information about the Numpy-svn mailing list