[Numpy-svn] r8195 - in trunk/numpy: lib/tests ma/tests matrixlib/tests testing/tests

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 16:31:25 CST 2010


Author: charris
Date: 2010-02-20 16:31:25 -0600 (Sat, 20 Feb 2010)
New Revision: 8195

Modified:
   trunk/numpy/lib/tests/test_io.py
   trunk/numpy/lib/tests/test_recfunctions.py
   trunk/numpy/lib/tests/test_regression.py
   trunk/numpy/lib/tests/test_twodim_base.py
   trunk/numpy/ma/tests/test_core.py
   trunk/numpy/ma/tests/test_extras.py
   trunk/numpy/ma/tests/test_mrecords.py
   trunk/numpy/ma/tests/test_old_ma.py
   trunk/numpy/ma/tests/test_subclassing.py
   trunk/numpy/matrixlib/tests/test_regression.py
   trunk/numpy/testing/tests/test_utils.py
Log:
DEP: Fix deprecation warnings in Python 3.1. The warnings come from the unittest
module. The fix should be good for Python >= 2.4 and used the following sed script:

s/\<failUnless\>/assertTrue/g
s/\<failIf\>/assertFalse/g
s/\<failUnlessEqual\>/assertEqual/g
s/\<failUnlessRaises\>/assertRaises/g

Modified: trunk/numpy/lib/tests/test_io.py
===================================================================
--- trunk/numpy/lib/tests/test_io.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/lib/tests/test_io.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -1094,7 +1094,7 @@
         test = np.recfromtxt(data, **kwargs)
         control = np.array([(0, 1), (2, 3)],
                            dtype=[('A', np.int), ('B', np.int)])
-        self.failUnless(isinstance(test, np.recarray))
+        self.assertTrue(isinstance(test, np.recarray))
         assert_equal(test, control)
         #
         data = StringIO('A,B\n0,1\n2,N/A')
@@ -1114,7 +1114,7 @@
         test = np.recfromcsv(data, dtype=None, **kwargs)
         control = np.array([(0, 1), (2, 3)],
                            dtype=[('A', np.int), ('B', np.int)])
-        self.failUnless(isinstance(test, np.recarray))
+        self.assertTrue(isinstance(test, np.recarray))
         assert_equal(test, control)
         #
         data = StringIO('A,B\n0,1\n2,N/A')
@@ -1130,7 +1130,7 @@
         test = np.recfromcsv(data, missing_values='N/A',)
         control = np.array([(0, 1), (2, 3)],
                            dtype=[('a', np.int), ('b', np.int)])
-        self.failUnless(isinstance(test, np.recarray))
+        self.assertTrue(isinstance(test, np.recarray))
         assert_equal(test, control)
 
 

Modified: trunk/numpy/lib/tests/test_recfunctions.py
===================================================================
--- trunk/numpy/lib/tests/test_recfunctions.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/lib/tests/test_recfunctions.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -399,11 +399,11 @@
         (_, x, _, _) = self.data
         test = stack_arrays((x,))
         assert_equal(test, x)
-        self.failUnless(test is x)
+        self.assertTrue(test is x)
         #
         test = stack_arrays(x)
         assert_equal(test, x)
-        self.failUnless(test is x)
+        self.assertTrue(test is x)
     #
     def test_unnamed_fields(self):
         "Tests combinations of arrays w/o named fields"

Modified: trunk/numpy/lib/tests/test_regression.py
===================================================================
--- trunk/numpy/lib/tests/test_regression.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/lib/tests/test_regression.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -48,7 +48,7 @@
     def test_poly1d_nan_roots(self, level=rlevel):
         """Ticket #396"""
         p = np.poly1d([np.nan,np.nan,1], r=0)
-        self.failUnlessRaises(np.linalg.LinAlgError,getattr,p,"r")
+        self.assertRaises(np.linalg.LinAlgError,getattr,p,"r")
 
     def test_mem_polymul(self, level=rlevel):
         """Ticket #448"""
@@ -146,8 +146,8 @@
             a = np.ones((n,)*5)
             i = np.random.randint(0,n,size=thesize)
             g = a[np.ix_(i,i,i,i,i)]
-        self.failUnlessRaises(ValueError, dp)
-        self.failUnlessRaises(ValueError, dp2)
+        self.assertRaises(ValueError, dp)
+        self.assertRaises(ValueError, dp2)
 
     def test_void_coercion(self, level=rlevel):
         dt = np.dtype([('a','f4'),('b','i4')])

Modified: trunk/numpy/lib/tests/test_twodim_base.py
===================================================================
--- trunk/numpy/lib/tests/test_twodim_base.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/lib/tests/test_twodim_base.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -114,11 +114,11 @@
         assert_equal(diag(A, k=-3), [])
 
     def test_failure(self):
-        self.failUnlessRaises(ValueError, diag, [[[1]]])
+        self.assertRaises(ValueError, diag, [[[1]]])
 
 class TestFliplr(TestCase):
     def test_basic(self):
-        self.failUnlessRaises(ValueError, fliplr, ones(4))
+        self.assertRaises(ValueError, fliplr, ones(4))
         a = get_mat(4)
         b = a[:,::-1]
         assert_equal(fliplr(a),b)
@@ -141,7 +141,7 @@
 
 class TestRot90(TestCase):
     def test_basic(self):
-        self.failUnlessRaises(ValueError, rot90, ones(4))
+        self.assertRaises(ValueError, rot90, ones(4))
 
         a = [[0,1,2],
              [3,4,5]]

Modified: trunk/numpy/ma/tests/test_core.py
===================================================================
--- trunk/numpy/ma/tests/test_core.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/ma/tests/test_core.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -64,14 +64,14 @@
         x = masked_array(0, mask=False)
         assert_equal(str(x), '0')
         x = array(0, mask=1)
-        self.failUnless(x.filled().dtype is x._data.dtype)
+        self.assertTrue(x.filled().dtype is x._data.dtype)
 
     def test_basic1d(self):
         "Test of basic array creation and properties in 1 dimension."
         (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
-        self.failUnless(not isMaskedArray(x))
-        self.failUnless(isMaskedArray(xm))
-        self.failUnless((xm - ym).filled(0).any())
+        self.assertTrue(not isMaskedArray(x))
+        self.assertTrue(isMaskedArray(xm))
+        self.assertTrue((xm - ym).filled(0).any())
         fail_if_equal(xm.mask.astype(int), ym.mask.astype(int))
         s = x.shape
         assert_equal(np.shape(xm), s)
@@ -95,8 +95,8 @@
             ym.shape = s
             xf.shape = s
             #
-            self.failUnless(not isMaskedArray(x))
-            self.failUnless(isMaskedArray(xm))
+            self.assertTrue(not isMaskedArray(x))
+            self.assertTrue(isMaskedArray(xm))
             assert_equal(shape(xm), s)
             assert_equal(xm.shape, s)
             assert_equal(xm.size , reduce(lambda x, y:x * y, s))
@@ -180,7 +180,7 @@
         x.mask = nomask
         data = array((x, x[::-1]))
         assert_equal(data, [[0, 1, 2, 3, 4], [4, 3, 2, 1, 0]])
-        self.failUnless(data.mask is nomask)
+        self.assertTrue(data.mask is nomask)
 
     def test_asarray(self):
         (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d
@@ -203,14 +203,14 @@
         "Test of masked element"
         x = arange(6)
         x[1] = masked
-        self.failUnless(str(masked) == '--')
-        self.failUnless(x[1] is masked)
+        self.assertTrue(str(masked) == '--')
+        self.assertTrue(x[1] is masked)
         assert_equal(filled(x[1], 0), 0)
         # don't know why these should raise an exception...
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, masked)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, 2)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, xx)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, xx, masked)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, masked)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, 2)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, xx)
+        #self.assertRaises(Exception, lambda x,y: x+y, xx, masked)
 
     def test_set_element_as_object(self):
         """Tests setting elements with object"""
@@ -218,12 +218,12 @@
         x = (1, 2, 3, 4, 5)
         a[0] = x
         assert_equal(a[0], x)
-        self.failUnless(a[0] is x)
+        self.assertTrue(a[0] is x)
         #
         import datetime
         dt = datetime.datetime.now()
         a[0] = dt
-        self.failUnless(a[0] is dt)
+        self.assertTrue(a[0] is dt)
 
 
     def test_indexing(self):
@@ -282,39 +282,39 @@
         n = [0, 0, 1, 0, 0]
         m = make_mask(n)
         m2 = make_mask(m)
-        self.failUnless(m is m2)
+        self.assertTrue(m is m2)
         m3 = make_mask(m, copy=1)
-        self.failUnless(m is not m3)
+        self.assertTrue(m is not m3)
 
         warnings.simplefilter('ignore', DeprecationWarning)
         x1 = np.arange(5)
         y1 = array(x1, mask=m)
-        #self.failUnless( y1._data is x1)
+        #self.assertTrue( y1._data is x1)
         assert_equal(y1._data.__array_interface__, x1.__array_interface__)
-        self.failUnless(allequal(x1, y1.raw_data()))
-        #self.failUnless( y1.mask is m)
+        self.assertTrue(allequal(x1, y1.raw_data()))
+        #self.assertTrue( y1.mask is m)
         assert_equal(y1._mask.__array_interface__, m.__array_interface__)
         warnings.simplefilter('default', DeprecationWarning)
 
         y1a = array(y1)
-        #self.failUnless( y1a.raw_data() is y1.raw_data())
-        self.failUnless(y1a._data.__array_interface__ == y1._data.__array_interface__)
-        self.failUnless(y1a.mask is y1.mask)
+        #self.assertTrue( y1a.raw_data() is y1.raw_data())
+        self.assertTrue(y1a._data.__array_interface__ == y1._data.__array_interface__)
+        self.assertTrue(y1a.mask is y1.mask)
 
         y2 = array(x1, mask=m)
-        #self.failUnless( y2.raw_data() is x1)
-        self.failUnless(y2._data.__array_interface__ == x1.__array_interface__)
-        #self.failUnless( y2.mask is m)
-        self.failUnless(y2._mask.__array_interface__ == m.__array_interface__)
-        self.failUnless(y2[2] is masked)
+        #self.assertTrue( y2.raw_data() is x1)
+        self.assertTrue(y2._data.__array_interface__ == x1.__array_interface__)
+        #self.assertTrue( y2.mask is m)
+        self.assertTrue(y2._mask.__array_interface__ == m.__array_interface__)
+        self.assertTrue(y2[2] is masked)
         y2[2] = 9
-        self.failUnless(y2[2] is not masked)
-        #self.failUnless( y2.mask is not m)
-        self.failUnless(y2._mask.__array_interface__ != m.__array_interface__)
-        self.failUnless(allequal(y2.mask, 0))
+        self.assertTrue(y2[2] is not masked)
+        #self.assertTrue( y2.mask is not m)
+        self.assertTrue(y2._mask.__array_interface__ != m.__array_interface__)
+        self.assertTrue(allequal(y2.mask, 0))
 
         y3 = array(x1 * 1.0, mask=m)
-        self.failUnless(filled(y3).dtype is (x1 * 1.0).dtype)
+        self.assertTrue(filled(y3).dtype is (x1 * 1.0).dtype)
 
         x4 = arange(4)
         x4[2] = masked
@@ -380,7 +380,7 @@
         a_pickled = cPickle.loads(a.dumps())
         assert_equal(a_pickled._mask, a._mask)
         assert_equal(a_pickled, a)
-        self.failUnless(isinstance(a_pickled._data, np.matrix))
+        self.assertTrue(isinstance(a_pickled._data, np.matrix))
 
     def test_pickling_wstructured(self):
         "Tests pickling w/ structured array"
@@ -431,7 +431,7 @@
         a = array([1, 2, 3], mask=[1, 0, 0])
         self.assertRaises(TypeError, lambda:float(a))
         assert_equal(float(a[-1]), 3.)
-        self.failUnless(np.isnan(float(a[0])))
+        self.assertTrue(np.isnan(float(a[0])))
         self.assertRaises(TypeError, int, a)
         assert_equal(int(a[-1]), 3)
         self.assertRaises(MAError, lambda:int(a[0]))
@@ -610,14 +610,14 @@
         a = masked_array([(1, 2,), (3, 4)], mask=[(0, 0), (1, 0)], dtype=ndtype)
         # w/o mask
         f = a[0]
-        self.failUnless(isinstance(f, np.void))
+        self.assertTrue(isinstance(f, np.void))
         assert_equal((f[0], f['a']), (1, 1))
         assert_equal(f['b'], 2)
         # w/ mask
         f = a[1]
-        self.failUnless(isinstance(f, mvoid))
-        self.failUnless(f[0] is masked)
-        self.failUnless(f['a'] is masked)
+        self.assertTrue(isinstance(f, mvoid))
+        self.assertTrue(f[0] is masked)
+        self.assertTrue(f['a'] is masked)
         assert_equal(f[1], 4)
 
     def test_mvoid_iter(self):
@@ -710,8 +710,8 @@
         "Tests mixed arithmetics."
         na = np.array([1])
         ma = array([1])
-        self.failUnless(isinstance(na + ma, MaskedArray))
-        self.failUnless(isinstance(ma + na, MaskedArray))
+        self.assertTrue(isinstance(na + ma, MaskedArray))
+        self.assertTrue(isinstance(ma + na, MaskedArray))
 
 
     def test_limits_arithmetic(self):
@@ -725,11 +725,11 @@
         "Tests some scalar arithmetics on MaskedArrays."
         # Masked singleton should remain masked no matter what
         xm = array(0, mask=1)
-        self.failUnless((1 / array(0)).mask)
-        self.failUnless((1 + xm).mask)
-        self.failUnless((-xm).mask)
-        self.failUnless(maximum(xm, xm).mask)
-        self.failUnless(minimum(xm, xm).mask)
+        self.assertTrue((1 / array(0)).mask)
+        self.assertTrue((1 + xm).mask)
+        self.assertTrue((-xm).mask)
+        self.assertTrue(maximum(xm, xm).mask)
+        self.assertTrue(minimum(xm, xm).mask)
 
 
     def test_masked_singleton_equality(self):
@@ -801,7 +801,7 @@
     def test_count_func (self):
         "Tests count"
         ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0])
-        self.failUnless(isinstance(count(ott), int))
+        self.assertTrue(isinstance(count(ott), int))
         assert_equal(3, count(ott))
         assert_equal(1, count(1))
         assert_equal(0, array(1, mask=[1]))
@@ -840,19 +840,19 @@
     def test_minimummaximum_func(self):
         a = np.ones((2, 2))
         aminimum = minimum(a, a)
-        self.failUnless(isinstance(aminimum, MaskedArray))
+        self.assertTrue(isinstance(aminimum, MaskedArray))
         assert_equal(aminimum, np.minimum(a, a))
         #
         aminimum = minimum.outer(a, a)
-        self.failUnless(isinstance(aminimum, MaskedArray))
+        self.assertTrue(isinstance(aminimum, MaskedArray))
         assert_equal(aminimum, np.minimum.outer(a, a))
         #
         amaximum = maximum(a, a)
-        self.failUnless(isinstance(amaximum, MaskedArray))
+        self.assertTrue(isinstance(amaximum, MaskedArray))
         assert_equal(amaximum, np.maximum(a, a))
         #
         amaximum = maximum.outer(a, a)
-        self.failUnless(isinstance(amaximum, MaskedArray))
+        self.assertTrue(isinstance(amaximum, MaskedArray))
         assert_equal(amaximum, np.maximum.outer(a, a))
 
 
@@ -879,11 +879,11 @@
                 pass
             nout = np.empty((4,), dtype=float)
             result = npfunc(xm, axis=0, out=nout)
-            self.failUnless(result is nout)
+            self.assertTrue(result is nout)
             # Use the ma version
             nout.fill(-999)
             result = mafunc(xm, axis=0, out=nout)
-            self.failUnless(result is nout)
+            self.assertTrue(result is nout)
 
 
     def test_minmax_methods(self):
@@ -891,22 +891,22 @@
         (_, _, _, _, _, xm, _, _, _, _) = self.d
         xm.shape = (xm.size,)
         assert_equal(xm.max(), 10)
-        self.failUnless(xm[0].max() is masked)
-        self.failUnless(xm[0].max(0) is masked)
-        self.failUnless(xm[0].max(-1) is masked)
+        self.assertTrue(xm[0].max() is masked)
+        self.assertTrue(xm[0].max(0) is masked)
+        self.assertTrue(xm[0].max(-1) is masked)
         assert_equal(xm.min(), -10.)
-        self.failUnless(xm[0].min() is masked)
-        self.failUnless(xm[0].min(0) is masked)
-        self.failUnless(xm[0].min(-1) is masked)
+        self.assertTrue(xm[0].min() is masked)
+        self.assertTrue(xm[0].min(0) is masked)
+        self.assertTrue(xm[0].min(-1) is masked)
         assert_equal(xm.ptp(), 20.)
-        self.failUnless(xm[0].ptp() is masked)
-        self.failUnless(xm[0].ptp(0) is masked)
-        self.failUnless(xm[0].ptp(-1) is masked)
+        self.assertTrue(xm[0].ptp() is masked)
+        self.assertTrue(xm[0].ptp(0) is masked)
+        self.assertTrue(xm[0].ptp(-1) is masked)
         #
         x = array([1, 2, 3], mask=True)
-        self.failUnless(x.min() is masked)
-        self.failUnless(x.max() is masked)
-        self.failUnless(x.ptp() is masked)
+        self.assertTrue(x.min() is masked)
+        self.assertTrue(x.max() is masked)
+        self.assertTrue(x.ptp() is masked)
 
 
     def test_addsumprod (self):
@@ -1081,13 +1081,13 @@
             output.fill(-9999)
             result = npfunc(xm, axis=0, out=output)
             # ... the result should be the given output
-            self.failUnless(result is output)
+            self.assertTrue(result is output)
             assert_equal(result, xmmeth(axis=0, out=output))
             #
             output = empty(4, dtype=int)
             result = xmmeth(axis=0, out=output)
-            self.failUnless(result is output)
-            self.failUnless(output[0] is masked)
+            self.assertTrue(result is output)
+            self.assertTrue(output[0] is masked)
 
 
     def test_eq_on_structured(self):
@@ -1173,8 +1173,8 @@
         assert_equal(xs._data, [0, 10, 2, 3, 40])
         #assert_equal(xh.mask.ctypes._data, m.ctypes._data)
         assert_equal(xs.mask, [0, 0, 0, 1, 0])
-        self.failUnless(xh._hardmask)
-        self.failUnless(not xs._hardmask)
+        self.assertTrue(xh._hardmask)
+        self.assertTrue(not xs._hardmask)
         xh[1:4] = [10, 20, 30]
         xs[1:4] = [10, 20, 30]
         assert_equal(xh._data, [0, 10, 20, 3, 4])
@@ -1306,39 +1306,39 @@
         ndtype = [('a', int), ('b', float), ('c', "|S3")]
         # A check on a list should return a single record
         fval = _check_fill_value([-999, -999.9, "???"], ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [-999, -999.9, "???"])
         # A check on None should output the defaults
         fval = _check_fill_value(None, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [default_fill_value(0),
                                    default_fill_value(0.),
                                    default_fill_value("0")])
         #.....Using a structured type as fill_value should work
         fill_val = np.array((-999, -999.9, "???"), dtype=ndtype)
         fval = _check_fill_value(fill_val, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [-999, -999.9, "???"])
         #.....Using a flexible type w/ a different type shouldn't matter
         fill_val = np.array((-999, -999.9, "???"),
                             dtype=[("A", int), ("B", float), ("C", "|S3")])
         fval = _check_fill_value(fill_val, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [-999, -999.9, "???"])
         #.....Using an object-array shouldn't matter either
         fill_value = np.array((-999, -999.9, "???"), dtype=object)
         fval = _check_fill_value(fill_val, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [-999, -999.9, "???"])
         #
         fill_value = np.array((-999, -999.9, "???"))
         fval = _check_fill_value(fill_val, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), [-999, -999.9, "???"])
         #.....One-field-only flexible type should work as well
         ndtype = [("a", int)]
         fval = _check_fill_value(-999, ndtype)
-        self.failUnless(isinstance(fval, ndarray))
+        self.assertTrue(isinstance(fval, ndarray))
         assert_equal(fval.item(), (-999,))
 
 
@@ -1518,8 +1518,8 @@
     def test_reduce(self):
         "Tests reduce on MaskedArrays."
         a = self.d[0]
-        self.failUnless(not alltrue(a, axis=0))
-        self.failUnless(sometrue(a, axis=0))
+        self.assertTrue(not alltrue(a, axis=0))
+        self.assertTrue(sometrue(a, axis=0))
         assert_equal(sum(a[:3], axis=0), 0)
         assert_equal(product(a, axis=0), 0)
         assert_equal(add.reduce(a), pi)
@@ -1532,8 +1532,8 @@
         assert_equal(amask.min(), 5)
         assert_equal(amask.max(0), a.max(0))
         assert_equal(amask.min(0), [5, 6, 7, 8])
-        self.failUnless(amask.max(1)[0].mask)
-        self.failUnless(amask.min(1)[0].mask)
+        self.assertTrue(amask.max(1)[0].mask)
+        self.assertTrue(amask.min(1)[0].mask)
 
     def test_ndarray_mask(self):
         "Check that the mask of the result is a ndarray (not a MaskedArray...)"
@@ -1543,7 +1543,7 @@
                           mask=[1, 0, 0, 0, 1])
         assert_equal(test, control)
         assert_equal(test.mask, control.mask)
-        self.failUnless(not isinstance(test.mask, MaskedArray))
+        self.assertTrue(not isinstance(test.mask, MaskedArray))
 
 
 #------------------------------------------------------------------------------
@@ -1892,21 +1892,21 @@
         "Tests allclose on arrays"
         a = np.random.rand(10)
         b = a + np.random.rand(10) * 1e-8
-        self.failUnless(allclose(a, b))
+        self.assertTrue(allclose(a, b))
         # Test allclose w/ infs
         a[0] = np.inf
-        self.failUnless(not allclose(a, b))
+        self.assertTrue(not allclose(a, b))
         b[0] = np.inf
-        self.failUnless(allclose(a, b))
+        self.assertTrue(allclose(a, b))
         # Test all close w/ masked
         a = masked_array(a)
         a[-1] = masked
-        self.failUnless(allclose(a, b, masked_equal=True))
-        self.failUnless(not allclose(a, b, masked_equal=False))
+        self.assertTrue(allclose(a, b, masked_equal=True))
+        self.assertTrue(not allclose(a, b, masked_equal=False))
         # Test comparison w/ scalar
         a *= 1e-8
         a[0] = 0
-        self.failUnless(allclose(a, 0, masked_equal=True))
+        self.assertTrue(allclose(a, 0, masked_equal=True))
 
 
     def test_allany(self):
@@ -1971,18 +1971,18 @@
         store = empty(1, dtype=bool)
         full = array([1, 2, 3], mask=True)
         #
-        self.failUnless(full.all() is masked)
+        self.assertTrue(full.all() is masked)
         full.all(out=store)
-        self.failUnless(store)
-        self.failUnless(store._mask, True)
-        self.failUnless(store is not masked)
+        self.assertTrue(store)
+        self.assertTrue(store._mask, True)
+        self.assertTrue(store is not masked)
         #
         store = empty(1, dtype=bool)
-        self.failUnless(full.any() is masked)
+        self.assertTrue(full.any() is masked)
         full.any(out=store)
-        self.failUnless(not store)
-        self.failUnless(store._mask, True)
-        self.failUnless(store is not masked)
+        self.assertTrue(not store)
+        self.assertTrue(store._mask, True)
+        self.assertTrue(store is not masked)
 
 
     def test_argmax_argmin(self):
@@ -2070,7 +2070,7 @@
         a = array(np.matrix([1, 2, 3, 4]), mask=[0, 0, 0, 0])
         b = a.compressed()
         assert_equal(b, a)
-        self.failUnless(isinstance(b, np.matrix))
+        self.assertTrue(isinstance(b, np.matrix))
         a[0, 0] = masked
         b = a.compressed()
         assert_equal(b, [[2, 3, 4]])
@@ -2098,12 +2098,12 @@
         n = [0, 0, 0, 1, 1]
         m = make_mask(n)
         x = array(d, mask=m)
-        self.failUnless(x[3] is masked)
-        self.failUnless(x[4] is masked)
+        self.assertTrue(x[3] is masked)
+        self.assertTrue(x[4] is masked)
         x[[1, 4]] = [10, 40]
-#        self.failUnless( x.mask is not m)
-        self.failUnless(x[3] is masked)
-        self.failUnless(x[4] is not masked)
+#        self.assertTrue( x.mask is not m)
+        self.assertTrue(x[3] is masked)
+        self.assertTrue(x[4] is not masked)
         assert_equal(x, [0, 10, 2, -1, 40])
         #
         x = masked_array(arange(10), mask=[1, 0, 0, 0, 0] * 2)
@@ -2223,7 +2223,7 @@
         #
         x = [1, 4, 2, 3]
         sortedx = sort(x)
-        self.failUnless(not isinstance(sorted, MaskedArray))
+        self.assertTrue(not isinstance(sorted, MaskedArray))
         #
         x = array([0, 1, -1, -2, 2], mask=nomask, dtype=np.int8)
         sortedx = sort(x, endwith=False)
@@ -2309,7 +2309,7 @@
         assert_equal(data.squeeze(), [1, 2, 3])
         assert_equal(data.squeeze()._mask, [1, 1, 1])
         data = masked_array([[1]], mask=True)
-        self.failUnless(data.squeeze() is masked)
+        self.assertTrue(data.squeeze() is masked)
 
 
     def test_swapaxes(self):
@@ -2357,8 +2357,8 @@
         x = array(np.arange(12))
         x[[1, -2]] = masked
         xlist = x.tolist()
-        self.failUnless(xlist[1] is None)
-        self.failUnless(xlist[-2] is None)
+        self.assertTrue(xlist[1] is None)
+        self.assertTrue(xlist[-2] is None)
         # ... on 2D
         x.shape = (3, 4)
         xlist = x.tolist()
@@ -2528,12 +2528,12 @@
             output.fill(-9999)
             result = npfunc(xm, axis=0, out=output)
             # ... the result should be the given output
-            self.failUnless(result is output)
+            self.assertTrue(result is output)
             assert_equal(result, xmmeth(axis=0, out=output))
             #
             output = empty((3, 4), dtype=int)
             result = xmmeth(axis=0, out=output)
-            self.failUnless(result is output)
+            self.assertTrue(result is output)
 
 
     def test_ptp(self):
@@ -2609,31 +2609,31 @@
         x = array(arange(10), mask=True)
         for methodname in ('var', 'std'):
             method = getattr(x, methodname)
-            self.failUnless(method() is masked)
-            self.failUnless(method(0) is masked)
-            self.failUnless(method(-1) is masked)
+            self.assertTrue(method() is masked)
+            self.assertTrue(method(0) is masked)
+            self.assertTrue(method(-1) is masked)
             # Using a masked array as explicit output
             _ = method(out=mout)
-            self.failUnless(mout is not masked)
+            self.assertTrue(mout is not masked)
             assert_equal(mout.mask, True)
             # Using a ndarray as explicit output
             _ = method(out=nout)
-            self.failUnless(np.isnan(nout))
+            self.assertTrue(np.isnan(nout))
         #
         x = array(arange(10), mask=True)
         x[-1] = 9
         for methodname in ('var', 'std'):
             method = getattr(x, methodname)
-            self.failUnless(method(ddof=1) is masked)
-            self.failUnless(method(0, ddof=1) is masked)
-            self.failUnless(method(-1, ddof=1) is masked)
+            self.assertTrue(method(ddof=1) is masked)
+            self.assertTrue(method(0, ddof=1) is masked)
+            self.assertTrue(method(-1, ddof=1) is masked)
             # Using a masked array as explicit output
             _ = method(out=mout, ddof=1)
-            self.failUnless(mout is not masked)
+            self.assertTrue(mout is not masked)
             assert_equal(mout.mask, True)
             # Using a ndarray as explicit output
             _ = method(out=nout, ddof=1)
-            self.failUnless(np.isnan(nout))
+            self.assertTrue(np.isnan(nout))
 
 
     def test_diag(self):
@@ -2841,24 +2841,24 @@
         output.fill(-9999)
         result = np.round(xm, decimals=2, out=output)
         # ... the result should be the given output
-        self.failUnless(result is output)
+        self.assertTrue(result is output)
         assert_equal(result, xm.round(decimals=2, out=output))
         #
         output = empty((3, 4), dtype=float)
         result = xm.round(decimals=2, out=output)
-        self.failUnless(result is output)
+        self.assertTrue(result is output)
 
 
     def test_identity(self):
         a = identity(5)
-        self.failUnless(isinstance(a, MaskedArray))
+        self.assertTrue(isinstance(a, MaskedArray))
         assert_equal(a, np.identity(5))
 
 
     def test_power(self):
         x = -1.1
         assert_almost_equal(power(x, 2.), 1.21)
-        self.failUnless(power(x, masked) is masked)
+        self.assertTrue(power(x, masked) is masked)
         x = array([-1.1, -1.1, 1.1, 1.1, 0.])
         b = array([0.5, 2., 0.5, 2., -1.], mask=[0, 0, 0, 0, 1])
         y = power(x, b)
@@ -3000,7 +3000,7 @@
         store = empty(4, dtype=int)
         chosen = choose([2, 3, 1, 0], choices, out=store)
         assert_equal(store, array([20, 31, 12, 3]))
-        self.failUnless(store is chosen)
+        self.assertTrue(store is chosen)
         # Check with some masked indices + out
         store = empty(4, dtype=int)
         indices_ = array([2, 3, 1, 0], mask=[1, 0, 0, 1])
@@ -3022,25 +3022,25 @@
         # Try the default
         b = a.reshape((5, 2))
         assert_equal(b.shape, (5, 2))
-        self.failUnless(b.flags['C'])
+        self.assertTrue(b.flags['C'])
         # Try w/ arguments as list instead of tuple
         b = a.reshape(5, 2)
         assert_equal(b.shape, (5, 2))
-        self.failUnless(b.flags['C'])
+        self.assertTrue(b.flags['C'])
         # Try w/ order
         b = a.reshape((5, 2), order='F')
         assert_equal(b.shape, (5, 2))
-        self.failUnless(b.flags['F'])
+        self.assertTrue(b.flags['F'])
         # Try w/ order
         b = a.reshape(5, 2, order='F')
         assert_equal(b.shape, (5, 2))
-        self.failUnless(b.flags['F'])
+        self.assertTrue(b.flags['F'])
         #
         c = np.reshape(a, (2, 5))
-        self.failUnless(isinstance(c, MaskedArray))
+        self.assertTrue(isinstance(c, MaskedArray))
         assert_equal(c.shape, (2, 5))
-        self.failUnless(c[0, 0] is masked)
-        self.failUnless(c.flags['C'])
+        self.assertTrue(c[0, 0] is masked)
+        self.assertTrue(c.flags['C'])
 
 
     def test_make_mask_descr(self):
@@ -3271,7 +3271,7 @@
         #
         test = a.view((float, 2), np.matrix)
         assert_equal(test, data)
-        self.failUnless(isinstance(test, np.matrix))
+        self.assertTrue(isinstance(test, np.matrix))
     #
     def test_getitem(self):
         ndtype = [('a', float), ('b', float)]
@@ -3280,13 +3280,13 @@
                               [1, 0, 0, 0, 0, 0, 0, 0, 1, 0]),
                           dtype=[('a', bool), ('b', bool)])
         # No mask
-        self.failUnless(isinstance(a[1], np.void))
+        self.assertTrue(isinstance(a[1], np.void))
         # One element masked
-        self.failUnless(isinstance(a[0], MaskedArray))
+        self.assertTrue(isinstance(a[0], MaskedArray))
         assert_equal_records(a[0]._data, a._data[0])
         assert_equal_records(a[0]._mask, a._mask[0])
         # All element masked
-        self.failUnless(isinstance(a[-2], MaskedArray))
+        self.assertTrue(isinstance(a[-2], MaskedArray))
         assert_equal_records(a[-2]._data, a._data[-2])
         assert_equal_records(a[-2]._mask, a._mask[-2])
 
@@ -3306,7 +3306,7 @@
     def test_view_to_nothing(self):
         (data, a, controlmask) = self.data
         test = a.view()
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test._data, a._data)
         assert_equal(test._mask, a._mask)
 
@@ -3314,7 +3314,7 @@
     def test_view_to_type(self):
         (data, a, controlmask) = self.data
         test = a.view(np.ndarray)
-        self.failUnless(not isinstance(test, MaskedArray))
+        self.assertTrue(not isinstance(test, MaskedArray))
         assert_equal(test, a._data)
         assert_equal_records(test, data.view(a.dtype).squeeze())
     #
@@ -3322,7 +3322,7 @@
         (data, a, controlmask) = self.data
         # View globally
         test = a.view(float)
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test, data.ravel())
         assert_equal(test.mask, controlmask)
     #
@@ -3335,13 +3335,13 @@
         assert_equal(test['B'], a['b'])
         #
         test = a[0].view([('A', float), ('B', float)])
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test.mask.dtype.names, ('A', 'B'))
         assert_equal(test['A'], a['a'][0])
         assert_equal(test['B'], a['b'][0])
         #
         test = a[-1].view([('A', float), ('B', float)])
-        self.failUnless(not isinstance(test, MaskedArray))
+        self.assertTrue(not isinstance(test, MaskedArray))
         assert_equal(test.dtype.names, ('A', 'B'))
         assert_equal(test['A'], a['a'][-1])
         assert_equal(test['B'], a['b'][-1])
@@ -3351,17 +3351,17 @@
         (data, a, controlmask) = self.data
         # View globally
         test = a.view((float, 2))
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test, data)
         assert_equal(test.mask, controlmask.reshape(-1, 2))
         # View on 1 masked element
         test = a[0].view((float, 2))
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test, data[0])
         assert_equal(test.mask, (1, 0))
         # View on 1 unmasked element
         test = a[-1].view((float, 2))
-        self.failUnless(not isinstance(test, MaskedArray))
+        self.assertTrue(not isinstance(test, MaskedArray))
         assert_equal(test, data[-1])
     #
     def test_view_to_dtype_and_type(self):
@@ -3369,8 +3369,8 @@
         #
         test = a.view((float, 2), np.matrix)
         assert_equal(test, data)
-        self.failUnless(isinstance(test, np.matrix))
-        self.failUnless(not isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, np.matrix))
+        self.assertTrue(not isinstance(test, MaskedArray))
 
 def test_masked_array():
     a = np.ma.array([0, 1, 2, 3], mask=[0, 0, 1, 0])

Modified: trunk/numpy/ma/tests/test_extras.py
===================================================================
--- trunk/numpy/ma/tests/test_extras.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/ma/tests/test_extras.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -99,7 +99,7 @@
         assert_equal(2.0, average(ott, weights=[1., 1., 2., 1.]))
         result, wts = average(ott, weights=[1., 1., 2., 1.], returned=1)
         assert_equal(2.0, result)
-        self.failUnless(wts == 4.0)
+        self.assertTrue(wts == 4.0)
         ott[:] = masked
         assert_equal(average(ott, axis=0).mask, [True])
         ott = array([0., 1., 2., 3.], mask=[True, False, False, False])
@@ -189,7 +189,7 @@
         m = [1,0,0,0,0]
         d = masked_array(b,mask=m)
         c = mr_[d,0,0,d]
-        self.failUnless(isinstance(c,MaskedArray) or isinstance(c,core.MaskedArray))
+        self.assertTrue(isinstance(c,MaskedArray) or isinstance(c,core.MaskedArray))
         assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])
         assert_array_equal(c.mask, mr_[m,0,0,m])
 
@@ -202,12 +202,12 @@
         b_1 = masked_array(a_1,mask=m_1)
         b_2 = masked_array(a_2,mask=m_2)
         d = mr_['1',b_1,b_2]  # append columns
-        self.failUnless(d.shape == (5,10))
+        self.assertTrue(d.shape == (5,10))
         assert_array_equal(d[:,:5],b_1)
         assert_array_equal(d[:,5:],b_2)
         assert_array_equal(d.mask, np.r_['1',m_1,m_2])
         d = mr_[b_1,b_2]
-        self.failUnless(d.shape == (10,5))
+        self.assertTrue(d.shape == (10,5))
         assert_array_equal(d[:5,:],b_1)
         assert_array_equal(d[5:,:],b_2)
         assert_array_equal(d.mask, np.r_[m_1,m_2])
@@ -266,14 +266,14 @@
         assert_equal(tmp[-3], slice(0,3,None))
         #
         tmp = notmasked_contiguous(a, 0)
-        self.failUnless(len(tmp[-1]) == 1)
-        self.failUnless(tmp[-2] is None)
+        self.assertTrue(len(tmp[-1]) == 1)
+        self.assertTrue(tmp[-2] is None)
         assert_equal(tmp[-3],tmp[-1])
-        self.failUnless(len(tmp[0]) == 2)
+        self.assertTrue(len(tmp[0]) == 2)
         #
         tmp = notmasked_contiguous(a, 1)
         assert_equal(tmp[0][-1], slice(0,3,None))
-        self.failUnless(tmp[1] is None)
+        self.assertTrue(tmp[1] is None)
         assert_equal(tmp[2][-1], slice(7,7,None))
         assert_equal(tmp[2][-2], slice(0,5,None))
 
@@ -315,12 +315,12 @@
         assert_equal(mask_rowcols(x,0).mask, [[1,1,1],[1,1,1],[0,0,0]] )
         assert_equal(mask_rowcols(x,1,).mask, [[1,1,0],[1,1,0],[1,1,0]] )
         x = array(x._data, mask=[[1,0,0],[0,1,0],[0,0,1]])
-        self.failUnless(mask_rowcols(x).all() is masked)
-        self.failUnless(mask_rowcols(x,0).all() is masked)
-        self.failUnless(mask_rowcols(x,1).all() is masked)
-        self.failUnless(mask_rowcols(x).mask.all())
-        self.failUnless(mask_rowcols(x,0).mask.all())
-        self.failUnless(mask_rowcols(x,1).mask.all())
+        self.assertTrue(mask_rowcols(x).all() is masked)
+        self.assertTrue(mask_rowcols(x,0).all() is masked)
+        self.assertTrue(mask_rowcols(x,1).all() is masked)
+        self.assertTrue(mask_rowcols(x).mask.all())
+        self.assertTrue(mask_rowcols(x,0).mask.all())
+        self.assertTrue(mask_rowcols(x,1).mask.all())
     #
     def test_dot(self):
         "Tests dot product"
@@ -607,7 +607,7 @@
         "Test unique on list"
         data = [1, 1, 1, 2, 2, 3]
         test = unique(data, return_index=True, return_inverse=True)
-        self.failUnless(isinstance(test[0], MaskedArray))
+        self.assertTrue(isinstance(test[0], MaskedArray))
         assert_equal(test[0], masked_array([1, 2, 3], mask=[0, 0, 0]))
         assert_equal(test[1], [0, 3, 5])
         assert_equal(test[2], [0, 0, 0, 1, 1, 2])
@@ -703,13 +703,13 @@
         test = ediff1d(x)
         control = array([1, 1, 1, 1], mask=[0, 0, 0, 0])
         assert_equal(test, control)
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test.data, control.data)
         assert_equal(test.mask, control.mask)
         #
         test = ediff1d(x, to_end=masked, to_begin=masked)
         control = array([0, 1, 1, 1, 1, 0], mask=[1, 0, 0, 0, 0, 1])
-        self.failUnless(isinstance(test, MaskedArray))
+        self.assertTrue(isinstance(test, MaskedArray))
         assert_equal(test.data, control.data)
         assert_equal(test.mask, control.mask)
 

Modified: trunk/numpy/ma/tests/test_mrecords.py
===================================================================
--- trunk/numpy/ma/tests/test_mrecords.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/ma/tests/test_mrecords.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -268,16 +268,16 @@
         base = self.base.copy()
         mbase = base.view(mrecarray)
         mbase.harden_mask()
-        self.failUnless(mbase._hardmask)
+        self.assertTrue(mbase._hardmask)
         mbase.mask = nomask
         assert_equal_records(mbase._mask, base._mask)
         mbase.soften_mask()
-        self.failUnless(not mbase._hardmask)
+        self.assertTrue(not mbase._hardmask)
         mbase.mask = nomask
         # So, the mask of a field is no longer set to nomask...
         assert_equal_records(mbase._mask,
                              ma.make_mask_none(base.shape,base.dtype))
-        self.failUnless(ma.make_mask(mbase['b']._mask) is nomask)
+        self.assertTrue(ma.make_mask(mbase['b']._mask) is nomask)
         assert_equal(mbase['a']._mask,mbase['b']._mask)
     #
     def test_pickling(self):
@@ -360,7 +360,7 @@
     def test_view_by_itself(self):
         (mrec, a, b, arr) = self.data
         test = mrec.view()
-        self.failUnless(isinstance(test, MaskedRecords))
+        self.assertTrue(isinstance(test, MaskedRecords))
         assert_equal_records(test, mrec)
         assert_equal_records(test._mask, mrec._mask)
     #
@@ -368,19 +368,19 @@
         (mrec, a, b, arr) = self.data
         ntype = (np.float, 2)
         test = mrec.view(ntype)
-        self.failUnless(isinstance(test, ma.MaskedArray))
+        self.assertTrue(isinstance(test, ma.MaskedArray))
         assert_equal(test, np.array(zip(a,b), dtype=np.float))
-        self.failUnless(test[3,1] is ma.masked)
+        self.assertTrue(test[3,1] is ma.masked)
     #
     def test_view_flexible_type(self):
         (mrec, a, b, arr) = self.data
         alttype = [('A',np.float), ('B',np.float)]
         test = mrec.view(alttype)
-        self.failUnless(isinstance(test, MaskedRecords))
+        self.assertTrue(isinstance(test, MaskedRecords))
         assert_equal_records(test, arr.view(alttype))
-        self.failUnless(test['B'][3] is masked)
+        self.assertTrue(test['B'][3] is masked)
         assert_equal(test.dtype, np.dtype(alttype))
-        self.failUnless(test._fill_value is None)
+        self.assertTrue(test._fill_value is None)
 
 
 ################################################################################
@@ -480,7 +480,7 @@
         mrectxt = fromtextfile(tmp_fl, delimitor=',',varnames='ABCDEFG')
         os.remove(tmp_fl)
         #
-        self.failUnless(isinstance(mrectxt, MaskedRecords))
+        self.assertTrue(isinstance(mrectxt, MaskedRecords))
         assert_equal(mrectxt.F, [1,1,1,1])
         assert_equal(mrectxt.E._mask, [1,1,1,1])
         assert_equal(mrectxt.C, [1,2,3.e+5,-1e-10])

Modified: trunk/numpy/ma/tests/test_old_ma.py
===================================================================
--- trunk/numpy/ma/tests/test_old_ma.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/ma/tests/test_old_ma.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -38,16 +38,16 @@
     def test_testBasic1d(self):
         "Test of basic array creation and properties in 1 dimension."
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
-        self.failIf(isMaskedArray(x))
-        self.failUnless(isMaskedArray(xm))
+        self.assertFalse(isMaskedArray(x))
+        self.assertTrue(isMaskedArray(xm))
         self.assertEqual(shape(xm), s)
         self.assertEqual(xm.shape, s)
         self.assertEqual(xm.dtype, x.dtype)
         self.assertEqual( xm.size , reduce(lambda x,y:x*y, s))
         self.assertEqual(count(xm) , len(m1) - reduce(lambda x,y:x+y, m1))
-        self.failUnless(eq(xm, xf))
-        self.failUnless(eq(filled(xm, 1.e20), xf))
-        self.failUnless(eq(x, xm))
+        self.assertTrue(eq(xm, xf))
+        self.assertTrue(eq(filled(xm, 1.e20), xf))
+        self.assertTrue(eq(x, xm))
 
     def test_testBasic2d(self):
         "Test of basic array creation and properties in 2 dimensions."
@@ -59,15 +59,15 @@
             ym.shape = s
             xf.shape = s
 
-            self.failIf(isMaskedArray(x))
-            self.failUnless(isMaskedArray(xm))
+            self.assertFalse(isMaskedArray(x))
+            self.assertTrue(isMaskedArray(xm))
             self.assertEqual(shape(xm), s)
             self.assertEqual(xm.shape, s)
             self.assertEqual( xm.size , reduce(lambda x,y:x*y, s))
             self.assertEqual( count(xm) , len(m1) - reduce(lambda x,y:x+y, m1))
-            self.failUnless(eq(xm, xf))
-            self.failUnless(eq(filled(xm, 1.e20), xf))
-            self.failUnless(eq(x, xm))
+            self.assertTrue(eq(xm, xf))
+            self.assertTrue(eq(filled(xm, 1.e20), xf))
+            self.assertTrue(eq(x, xm))
             self.setUp()
 
     def test_testArithmetic (self):
@@ -75,94 +75,94 @@
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
         a2d = array([[1,2],[0,4]])
         a2dm = masked_array(a2d, [[0,0],[1,0]])
-        self.failUnless(eq (a2d * a2d, a2d * a2dm))
-        self.failUnless(eq (a2d + a2d, a2d + a2dm))
-        self.failUnless(eq (a2d - a2d, a2d - a2dm))
+        self.assertTrue(eq (a2d * a2d, a2d * a2dm))
+        self.assertTrue(eq (a2d + a2d, a2d + a2dm))
+        self.assertTrue(eq (a2d - a2d, a2d - a2dm))
         for s in [(12,), (4,3), (2,6)]:
             x = x.reshape(s)
             y = y.reshape(s)
             xm = xm.reshape(s)
             ym = ym.reshape(s)
             xf = xf.reshape(s)
-            self.failUnless(eq(-x, -xm))
-            self.failUnless(eq(x + y, xm + ym))
-            self.failUnless(eq(x - y, xm - ym))
-            self.failUnless(eq(x * y, xm * ym))
+            self.assertTrue(eq(-x, -xm))
+            self.assertTrue(eq(x + y, xm + ym))
+            self.assertTrue(eq(x - y, xm - ym))
+            self.assertTrue(eq(x * y, xm * ym))
             olderr = numpy.seterr(divide='ignore', invalid='ignore')
-            self.failUnless(eq(x / y, xm / ym))
+            self.assertTrue(eq(x / y, xm / ym))
             numpy.seterr(**olderr)
-            self.failUnless(eq(a10 + y, a10 + ym))
-            self.failUnless(eq(a10 - y, a10 - ym))
-            self.failUnless(eq(a10 * y, a10 * ym))
+            self.assertTrue(eq(a10 + y, a10 + ym))
+            self.assertTrue(eq(a10 - y, a10 - ym))
+            self.assertTrue(eq(a10 * y, a10 * ym))
             olderr = numpy.seterr(divide='ignore', invalid='ignore')
-            self.failUnless(eq(a10 / y, a10 / ym))
+            self.assertTrue(eq(a10 / y, a10 / ym))
             numpy.seterr(**olderr)
-            self.failUnless(eq(x + a10, xm + a10))
-            self.failUnless(eq(x - a10, xm - a10))
-            self.failUnless(eq(x * a10, xm * a10))
-            self.failUnless(eq(x / a10, xm / a10))
-            self.failUnless(eq(x**2, xm**2))
-            self.failUnless(eq(abs(x)**2.5, abs(xm) **2.5))
-            self.failUnless(eq(x**y, xm**ym))
-            self.failUnless(eq(numpy.add(x,y), add(xm, ym)))
-            self.failUnless(eq(numpy.subtract(x,y), subtract(xm, ym)))
-            self.failUnless(eq(numpy.multiply(x,y), multiply(xm, ym)))
+            self.assertTrue(eq(x + a10, xm + a10))
+            self.assertTrue(eq(x - a10, xm - a10))
+            self.assertTrue(eq(x * a10, xm * a10))
+            self.assertTrue(eq(x / a10, xm / a10))
+            self.assertTrue(eq(x**2, xm**2))
+            self.assertTrue(eq(abs(x)**2.5, abs(xm) **2.5))
+            self.assertTrue(eq(x**y, xm**ym))
+            self.assertTrue(eq(numpy.add(x,y), add(xm, ym)))
+            self.assertTrue(eq(numpy.subtract(x,y), subtract(xm, ym)))
+            self.assertTrue(eq(numpy.multiply(x,y), multiply(xm, ym)))
             olderr = numpy.seterr(divide='ignore', invalid='ignore')
-            self.failUnless(eq(numpy.divide(x,y), divide(xm, ym)))
+            self.assertTrue(eq(numpy.divide(x,y), divide(xm, ym)))
             numpy.seterr(**olderr)
 
 
     def test_testMixedArithmetic(self):
         na = numpy.array([1])
         ma = array([1])
-        self.failUnless(isinstance(na + ma, MaskedArray))
-        self.failUnless(isinstance(ma + na, MaskedArray))
+        self.assertTrue(isinstance(na + ma, MaskedArray))
+        self.assertTrue(isinstance(ma + na, MaskedArray))
 
     def test_testUfuncs1 (self):
         "Test various functions such as sin, cos."
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
-        self.failUnless (eq(numpy.cos(x), cos(xm)))
-        self.failUnless (eq(numpy.cosh(x), cosh(xm)))
-        self.failUnless (eq(numpy.sin(x), sin(xm)))
-        self.failUnless (eq(numpy.sinh(x), sinh(xm)))
-        self.failUnless (eq(numpy.tan(x), tan(xm)))
-        self.failUnless (eq(numpy.tanh(x), tanh(xm)))
+        self.assertTrue (eq(numpy.cos(x), cos(xm)))
+        self.assertTrue (eq(numpy.cosh(x), cosh(xm)))
+        self.assertTrue (eq(numpy.sin(x), sin(xm)))
+        self.assertTrue (eq(numpy.sinh(x), sinh(xm)))
+        self.assertTrue (eq(numpy.tan(x), tan(xm)))
+        self.assertTrue (eq(numpy.tanh(x), tanh(xm)))
         olderr = numpy.seterr(divide='ignore', invalid='ignore')
-        self.failUnless (eq(numpy.sqrt(abs(x)), sqrt(xm)))
-        self.failUnless (eq(numpy.log(abs(x)), log(xm)))
-        self.failUnless (eq(numpy.log10(abs(x)), log10(xm)))
+        self.assertTrue (eq(numpy.sqrt(abs(x)), sqrt(xm)))
+        self.assertTrue (eq(numpy.log(abs(x)), log(xm)))
+        self.assertTrue (eq(numpy.log10(abs(x)), log10(xm)))
         numpy.seterr(**olderr)
-        self.failUnless (eq(numpy.exp(x), exp(xm)))
-        self.failUnless (eq(numpy.arcsin(z), arcsin(zm)))
-        self.failUnless (eq(numpy.arccos(z), arccos(zm)))
-        self.failUnless (eq(numpy.arctan(z), arctan(zm)))
-        self.failUnless (eq(numpy.arctan2(x, y), arctan2(xm, ym)))
-        self.failUnless (eq(numpy.absolute(x), absolute(xm)))
-        self.failUnless (eq(numpy.equal(x,y), equal(xm, ym)))
-        self.failUnless (eq(numpy.not_equal(x,y), not_equal(xm, ym)))
-        self.failUnless (eq(numpy.less(x,y), less(xm, ym)))
-        self.failUnless (eq(numpy.greater(x,y), greater(xm, ym)))
-        self.failUnless (eq(numpy.less_equal(x,y), less_equal(xm, ym)))
-        self.failUnless (eq(numpy.greater_equal(x,y), greater_equal(xm, ym)))
-        self.failUnless (eq(numpy.conjugate(x), conjugate(xm)))
-        self.failUnless (eq(numpy.concatenate((x,y)), concatenate((xm,ym))))
-        self.failUnless (eq(numpy.concatenate((x,y)), concatenate((x,y))))
-        self.failUnless (eq(numpy.concatenate((x,y)), concatenate((xm,y))))
-        self.failUnless (eq(numpy.concatenate((x,y,x)), concatenate((x,ym,x))))
+        self.assertTrue (eq(numpy.exp(x), exp(xm)))
+        self.assertTrue (eq(numpy.arcsin(z), arcsin(zm)))
+        self.assertTrue (eq(numpy.arccos(z), arccos(zm)))
+        self.assertTrue (eq(numpy.arctan(z), arctan(zm)))
+        self.assertTrue (eq(numpy.arctan2(x, y), arctan2(xm, ym)))
+        self.assertTrue (eq(numpy.absolute(x), absolute(xm)))
+        self.assertTrue (eq(numpy.equal(x,y), equal(xm, ym)))
+        self.assertTrue (eq(numpy.not_equal(x,y), not_equal(xm, ym)))
+        self.assertTrue (eq(numpy.less(x,y), less(xm, ym)))
+        self.assertTrue (eq(numpy.greater(x,y), greater(xm, ym)))
+        self.assertTrue (eq(numpy.less_equal(x,y), less_equal(xm, ym)))
+        self.assertTrue (eq(numpy.greater_equal(x,y), greater_equal(xm, ym)))
+        self.assertTrue (eq(numpy.conjugate(x), conjugate(xm)))
+        self.assertTrue (eq(numpy.concatenate((x,y)), concatenate((xm,ym))))
+        self.assertTrue (eq(numpy.concatenate((x,y)), concatenate((x,y))))
+        self.assertTrue (eq(numpy.concatenate((x,y)), concatenate((xm,y))))
+        self.assertTrue (eq(numpy.concatenate((x,y,x)), concatenate((x,ym,x))))
 
     def test_xtestCount (self):
         "Test count"
         ott = array([0.,1.,2.,3.], mask=[1,0,0,0])
-        self.failUnless( isinstance(count(ott), types.IntType))
+        self.assertTrue( isinstance(count(ott), types.IntType))
         self.assertEqual(3, count(ott))
         self.assertEqual(1, count(1))
-        self.failUnless (eq(0, array(1,mask=[1])))
+        self.assertTrue (eq(0, array(1,mask=[1])))
         ott=ott.reshape((2,2))
         assert isinstance(count(ott,0),numpy.ndarray)
         assert isinstance(count(ott), types.IntType)
-        self.failUnless (eq(3, count(ott)))
+        self.assertTrue (eq(3, count(ott)))
         assert getmask(count(ott,0)) is nomask
-        self.failUnless (eq([1,2],count(ott,0)))
+        self.assertTrue (eq([1,2],count(ott,0)))
 
     def test_testMinMax (self):
         "Test minimum and maximum."
@@ -171,31 +171,31 @@
         xmr = ravel(xm)
 
         #true because of careful selection of data
-        self.failUnless(eq(max(xr), maximum(xmr)))
+        self.assertTrue(eq(max(xr), maximum(xmr)))
 
         #true because of careful selection of data
-        self.failUnless(eq(min(xr), minimum(xmr)))
+        self.assertTrue(eq(min(xr), minimum(xmr)))
 
     def test_testAddSumProd (self):
         "Test add, sum, product."
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
-        self.failUnless (eq(numpy.add.reduce(x), add.reduce(x)))
-        self.failUnless (eq(numpy.add.accumulate(x), add.accumulate(x)))
-        self.failUnless (eq(4, sum(array(4),axis=0)))
-        self.failUnless (eq(4, sum(array(4), axis=0)))
-        self.failUnless (eq(numpy.sum(x,axis=0), sum(x,axis=0)))
-        self.failUnless (eq(numpy.sum(filled(xm,0),axis=0), sum(xm,axis=0)))
-        self.failUnless (eq(numpy.sum(x,0), sum(x,0)))
-        self.failUnless (eq(numpy.product(x,axis=0), product(x,axis=0)))
-        self.failUnless (eq(numpy.product(x,0), product(x,0)))
-        self.failUnless (eq(numpy.product(filled(xm,1),axis=0),
+        self.assertTrue (eq(numpy.add.reduce(x), add.reduce(x)))
+        self.assertTrue (eq(numpy.add.accumulate(x), add.accumulate(x)))
+        self.assertTrue (eq(4, sum(array(4),axis=0)))
+        self.assertTrue (eq(4, sum(array(4), axis=0)))
+        self.assertTrue (eq(numpy.sum(x,axis=0), sum(x,axis=0)))
+        self.assertTrue (eq(numpy.sum(filled(xm,0),axis=0), sum(xm,axis=0)))
+        self.assertTrue (eq(numpy.sum(x,0), sum(x,0)))
+        self.assertTrue (eq(numpy.product(x,axis=0), product(x,axis=0)))
+        self.assertTrue (eq(numpy.product(x,0), product(x,0)))
+        self.assertTrue (eq(numpy.product(filled(xm,1),axis=0),
                             product(xm,axis=0)))
         if len(s) > 1:
-            self.failUnless (eq(numpy.concatenate((x,y),1),
+            self.assertTrue (eq(numpy.concatenate((x,y),1),
                                 concatenate((xm,ym),1)))
-            self.failUnless (eq(numpy.add.reduce(x,1), add.reduce(x,1)))
-            self.failUnless (eq(numpy.sum(x,1), sum(x,1)))
-            self.failUnless (eq(numpy.product(x,1), product(x,1)))
+            self.assertTrue (eq(numpy.add.reduce(x,1), add.reduce(x,1)))
+            self.assertTrue (eq(numpy.sum(x,1), sum(x,1)))
+            self.assertTrue (eq(numpy.product(x,1), product(x,1)))
 
 
     def test_testCI(self):
@@ -252,39 +252,39 @@
         n = [0,0,1,0,0]
         m = make_mask(n)
         m2 = make_mask(m)
-        self.failUnless(m is m2)
+        self.assertTrue(m is m2)
         m3 = make_mask(m, copy=1)
-        self.failUnless(m is not m3)
+        self.assertTrue(m is not m3)
 
         x1 = numpy.arange(5)
         y1 = array(x1, mask=m)
-        self.failUnless( y1._data is not x1)
-        self.failUnless( allequal(x1,y1._data))
-        self.failUnless( y1.mask is m)
+        self.assertTrue( y1._data is not x1)
+        self.assertTrue( allequal(x1,y1._data))
+        self.assertTrue( y1.mask is m)
 
         y1a = array(y1, copy=0)
-        self.failUnless( y1a.mask is y1.mask)
+        self.assertTrue( y1a.mask is y1.mask)
 
         y2 = array(x1, mask=m, copy=0)
-        self.failUnless( y2.mask is m)
-        self.failUnless( y2[2] is masked)
+        self.assertTrue( y2.mask is m)
+        self.assertTrue( y2[2] is masked)
         y2[2]=9
-        self.failUnless( y2[2] is not masked)
-        self.failUnless( y2.mask is not m)
-        self.failUnless( allequal(y2.mask, 0))
+        self.assertTrue( y2[2] is not masked)
+        self.assertTrue( y2.mask is not m)
+        self.assertTrue( allequal(y2.mask, 0))
 
         y3 = array(x1*1.0, mask=m)
-        self.failUnless(filled(y3).dtype is (x1*1.0).dtype)
+        self.assertTrue(filled(y3).dtype is (x1*1.0).dtype)
 
         x4 = arange(4)
         x4[2] = masked
         y4 = resize(x4, (8,))
-        self.failUnless( eq(concatenate([x4,x4]), y4))
-        self.failUnless( eq(getmask(y4),[0,0,1,0,0,0,1,0]))
+        self.assertTrue( eq(concatenate([x4,x4]), y4))
+        self.assertTrue( eq(getmask(y4),[0,0,1,0,0,0,1,0]))
         y5 = repeat(x4, (2,2,2,2), axis=0)
-        self.failUnless( eq(y5, [0,0,1,1,2,2,3,3]))
+        self.assertTrue( eq(y5, [0,0,1,1,2,2,3,3]))
         y6 = repeat(x4, 2, axis=0)
-        self.failUnless( eq(y5, y6))
+        self.assertTrue( eq(y5, y6))
 
     def test_testPut(self):
         "Test of put"
@@ -292,19 +292,19 @@
         n = [0,0,0,1,1]
         m = make_mask(n)
         x = array(d, mask = m)
-        self.failUnless( x[3] is masked)
-        self.failUnless( x[4] is masked)
+        self.assertTrue( x[3] is masked)
+        self.assertTrue( x[4] is masked)
         x[[1,4]] = [10,40]
-        self.failUnless( x.mask is not m)
-        self.failUnless( x[3] is masked)
-        self.failUnless( x[4] is not masked)
-        self.failUnless( eq(x, [0,10,2,-1,40]))
+        self.assertTrue( x.mask is not m)
+        self.assertTrue( x[3] is masked)
+        self.assertTrue( x[4] is not masked)
+        self.assertTrue( eq(x, [0,10,2,-1,40]))
 
         x = array(d, mask = m)
         x.put([0,1,2],[-1,100,200])
-        self.failUnless( eq(x, [-1,100,200,0,0]))
-        self.failUnless( x[3] is masked)
-        self.failUnless( x[4] is masked)
+        self.assertTrue( eq(x, [-1,100,200,0,0]))
+        self.assertTrue( x[3] is masked)
+        self.assertTrue( x[4] is masked)
 
     def test_testMaPut(self):
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
@@ -505,67 +505,67 @@
         "Test of masked element"
         xx=arange(6)
         xx[1] = masked
-        self.failUnless(str(masked) ==  '--')
-        self.failUnless(xx[1] is masked)
-        self.failUnlessEqual(filled(xx[1], 0), 0)
+        self.assertTrue(str(masked) ==  '--')
+        self.assertTrue(xx[1] is masked)
+        self.assertEqual(filled(xx[1], 0), 0)
         # don't know why these should raise an exception...
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, masked)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, 2)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, masked, xx)
-        #self.failUnlessRaises(Exception, lambda x,y: x+y, xx, masked)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, masked)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, 2)
+        #self.assertRaises(Exception, lambda x,y: x+y, masked, xx)
+        #self.assertRaises(Exception, lambda x,y: x+y, xx, masked)
 
     def test_testAverage1(self):
         "Test of average."
         ott = array([0.,1.,2.,3.], mask=[1,0,0,0])
-        self.failUnless(eq(2.0, average(ott,axis=0)))
-        self.failUnless(eq(2.0, average(ott, weights=[1., 1., 2., 1.])))
+        self.assertTrue(eq(2.0, average(ott,axis=0)))
+        self.assertTrue(eq(2.0, average(ott, weights=[1., 1., 2., 1.])))
         result, wts = average(ott, weights=[1.,1.,2.,1.], returned=1)
-        self.failUnless(eq(2.0, result))
-        self.failUnless(wts == 4.0)
+        self.assertTrue(eq(2.0, result))
+        self.assertTrue(wts == 4.0)
         ott[:] = masked
-        self.failUnless(average(ott,axis=0) is masked)
+        self.assertTrue(average(ott,axis=0) is masked)
         ott = array([0.,1.,2.,3.], mask=[1,0,0,0])
         ott=ott.reshape(2,2)
         ott[:,1] = masked
-        self.failUnless(eq(average(ott,axis=0), [2.0, 0.0]))
-        self.failUnless(average(ott,axis=1)[0] is masked)
-        self.failUnless(eq([2.,0.], average(ott, axis=0)))
+        self.assertTrue(eq(average(ott,axis=0), [2.0, 0.0]))
+        self.assertTrue(average(ott,axis=1)[0] is masked)
+        self.assertTrue(eq([2.,0.], average(ott, axis=0)))
         result, wts = average(ott, axis=0, returned=1)
-        self.failUnless(eq(wts, [1., 0.]))
+        self.assertTrue(eq(wts, [1., 0.]))
 
     def test_testAverage2(self):
         "More tests of average."
         w1 = [0,1,1,1,1,0]
         w2 = [[0,1,1,1,1,0],[1,0,0,0,0,1]]
         x=arange(6)
-        self.failUnless(allclose(average(x, axis=0), 2.5))
-        self.failUnless(allclose(average(x, axis=0, weights=w1), 2.5))
+        self.assertTrue(allclose(average(x, axis=0), 2.5))
+        self.assertTrue(allclose(average(x, axis=0, weights=w1), 2.5))
         y=array([arange(6), 2.0*arange(6)])
-        self.failUnless(allclose(average(y, None),
+        self.assertTrue(allclose(average(y, None),
                                  numpy.add.reduce(numpy.arange(6))*3./12.))
-        self.failUnless(allclose(average(y, axis=0), numpy.arange(6) * 3./2.))
-        self.failUnless(allclose(average(y, axis=1),
+        self.assertTrue(allclose(average(y, axis=0), numpy.arange(6) * 3./2.))
+        self.assertTrue(allclose(average(y, axis=1),
                                  [average(x,axis=0), average(x,axis=0) * 2.0]))
-        self.failUnless(allclose(average(y, None, weights=w2), 20./6.))
-        self.failUnless(allclose(average(y, axis=0, weights=w2),
+        self.assertTrue(allclose(average(y, None, weights=w2), 20./6.))
+        self.assertTrue(allclose(average(y, axis=0, weights=w2),
                                  [0.,1.,2.,3.,4.,10.]))
-        self.failUnless(allclose(average(y, axis=1),
+        self.assertTrue(allclose(average(y, axis=1),
                                  [average(x,axis=0), average(x,axis=0) * 2.0]))
         m1 = zeros(6)
         m2 = [0,0,1,1,0,0]
         m3 = [[0,0,1,1,0,0],[0,1,1,1,1,0]]
         m4 = ones(6)
         m5 = [0, 1, 1, 1, 1, 1]
-        self.failUnless(allclose(average(masked_array(x, m1),axis=0), 2.5))
-        self.failUnless(allclose(average(masked_array(x, m2),axis=0), 2.5))
-        self.failUnless(average(masked_array(x, m4),axis=0) is masked)
+        self.assertTrue(allclose(average(masked_array(x, m1),axis=0), 2.5))
+        self.assertTrue(allclose(average(masked_array(x, m2),axis=0), 2.5))
+        self.assertTrue(average(masked_array(x, m4),axis=0) is masked)
         self.assertEqual(average(masked_array(x, m5),axis=0), 0.0)
         self.assertEqual(count(average(masked_array(x, m4),axis=0)), 0)
         z = masked_array(y, m3)
-        self.failUnless(allclose(average(z, None), 20./6.))
-        self.failUnless(allclose(average(z, axis=0), [0.,1.,99.,99.,4.0, 7.5]))
-        self.failUnless(allclose(average(z, axis=1), [2.5, 5.0]))
-        self.failUnless(allclose( average(z,axis=0, weights=w2),
+        self.assertTrue(allclose(average(z, None), 20./6.))
+        self.assertTrue(allclose(average(z, axis=0), [0.,1.,99.,99.,4.0, 7.5]))
+        self.assertTrue(allclose(average(z, axis=1), [2.5, 5.0]))
+        self.assertTrue(allclose( average(z,axis=0, weights=w2),
                                   [0.,1., 99., 99., 4.0, 10.0]))
 
         a = arange(6)
@@ -578,72 +578,72 @@
         r2, w2 = average(ones((2,2,3)), returned=1)
         self.assertEqual(shape(w2) , shape(r2))
         r2, w2 = average(ones((2,2,3)), weights=ones((2,2,3)), returned=1)
-        self.failUnless(shape(w2) == shape(r2))
+        self.assertTrue(shape(w2) == shape(r2))
         a2d = array([[1,2],[0,4]], float)
         a2dm = masked_array(a2d, [[0,0],[1,0]])
         a2da = average(a2d, axis=0)
-        self.failUnless(eq (a2da, [0.5, 3.0]))
+        self.assertTrue(eq (a2da, [0.5, 3.0]))
         a2dma = average(a2dm, axis=0)
-        self.failUnless(eq( a2dma, [1.0, 3.0]))
+        self.assertTrue(eq( a2dma, [1.0, 3.0]))
         a2dma = average(a2dm, axis=None)
-        self.failUnless(eq(a2dma, 7./3.))
+        self.assertTrue(eq(a2dma, 7./3.))
         a2dma = average(a2dm, axis=1)
-        self.failUnless(eq(a2dma, [1.5, 4.0]))
+        self.assertTrue(eq(a2dma, [1.5, 4.0]))
 
     def test_testToPython(self):
         self.assertEqual(1, int(array(1)))
         self.assertEqual(1.0, float(array(1)))
         self.assertEqual(1, int(array([[[1]]])))
         self.assertEqual(1.0, float(array([[1]])))
-        self.failUnlessRaises(TypeError, float, array([1,1]))
-        self.failUnlessRaises(ValueError, bool, array([0,1]))
-        self.failUnlessRaises(ValueError, bool, array([0,0],mask=[0,1]))
+        self.assertRaises(TypeError, float, array([1,1]))
+        self.assertRaises(ValueError, bool, array([0,1]))
+        self.assertRaises(ValueError, bool, array([0,0],mask=[0,1]))
 
     def test_testScalarArithmetic(self):
         xm = array(0, mask=1)
-        self.failUnless((1/array(0)).mask)
-        self.failUnless((1 + xm).mask)
-        self.failUnless((-xm).mask)
-        self.failUnless((-xm).mask)
-        self.failUnless(maximum(xm, xm).mask)
-        self.failUnless(minimum(xm, xm).mask)
-        self.failUnless(xm.filled().dtype is xm._data.dtype)
+        self.assertTrue((1/array(0)).mask)
+        self.assertTrue((1 + xm).mask)
+        self.assertTrue((-xm).mask)
+        self.assertTrue((-xm).mask)
+        self.assertTrue(maximum(xm, xm).mask)
+        self.assertTrue(minimum(xm, xm).mask)
+        self.assertTrue(xm.filled().dtype is xm._data.dtype)
         x = array(0, mask=0)
-        self.failUnless(x.filled() == x._data)
-        self.failUnlessEqual(str(xm), str(masked_print_option))
+        self.assertTrue(x.filled() == x._data)
+        self.assertEqual(str(xm), str(masked_print_option))
 
     def test_testArrayMethods(self):
         a = array([1,3,2])
         b = array([1,3,2], mask=[1,0,1])
-        self.failUnless(eq(a.any(), a._data.any()))
-        self.failUnless(eq(a.all(), a._data.all()))
-        self.failUnless(eq(a.argmax(), a._data.argmax()))
-        self.failUnless(eq(a.argmin(), a._data.argmin()))
-        self.failUnless(eq(a.choose(0,1,2,3,4), a._data.choose(0,1,2,3,4)))
-        self.failUnless(eq(a.compress([1,0,1]), a._data.compress([1,0,1])))
-        self.failUnless(eq(a.conj(), a._data.conj()))
-        self.failUnless(eq(a.conjugate(), a._data.conjugate()))
+        self.assertTrue(eq(a.any(), a._data.any()))
+        self.assertTrue(eq(a.all(), a._data.all()))
+        self.assertTrue(eq(a.argmax(), a._data.argmax()))
+        self.assertTrue(eq(a.argmin(), a._data.argmin()))
+        self.assertTrue(eq(a.choose(0,1,2,3,4), a._data.choose(0,1,2,3,4)))
+        self.assertTrue(eq(a.compress([1,0,1]), a._data.compress([1,0,1])))
+        self.assertTrue(eq(a.conj(), a._data.conj()))
+        self.assertTrue(eq(a.conjugate(), a._data.conjugate()))
         m = array([[1,2],[3,4]])
-        self.failUnless(eq(m.diagonal(), m._data.diagonal()))
-        self.failUnless(eq(a.sum(), a._data.sum()))
-        self.failUnless(eq(a.take([1,2]), a._data.take([1,2])))
-        self.failUnless(eq(m.transpose(), m._data.transpose()))
+        self.assertTrue(eq(m.diagonal(), m._data.diagonal()))
+        self.assertTrue(eq(a.sum(), a._data.sum()))
+        self.assertTrue(eq(a.take([1,2]), a._data.take([1,2])))
+        self.assertTrue(eq(m.transpose(), m._data.transpose()))
 
     def test_testArrayAttributes(self):
         a = array([1,3,2])
         b = array([1,3,2], mask=[1,0,1])
-        self.failUnlessEqual(a.ndim, 1)
+        self.assertEqual(a.ndim, 1)
 
     def test_testAPI(self):
-        self.failIf([m for m in dir(numpy.ndarray)
+        self.assertFalse([m for m in dir(numpy.ndarray)
                      if m not in dir(MaskedArray) and not m.startswith('_')])
 
     def test_testSingleElementSubscript(self):
         a = array([1,3,2])
         b = array([1,3,2], mask=[1,0,1])
-        self.failUnlessEqual(a[0].shape, ())
-        self.failUnlessEqual(b[0].shape, ())
-        self.failUnlessEqual(b[1].shape, ())
+        self.assertEqual(a[0].shape, ())
+        self.assertEqual(b[0].shape, ())
+        self.assertEqual(b[1].shape, ())
 
 class TestUfuncs(TestCase):
     def setUp(self):
@@ -689,30 +689,30 @@
             ur = uf(*args)
             mr = mf(*args)
             numpy.seterr(**olderr)
-            self.failUnless(eq(ur.filled(0), mr.filled(0), f))
-            self.failUnless(eqmask(ur.mask, mr.mask))
+            self.assertTrue(eq(ur.filled(0), mr.filled(0), f))
+            self.assertTrue(eqmask(ur.mask, mr.mask))
 
     def test_reduce(self):
         a = self.d[0]
-        self.failIf(alltrue(a,axis=0))
-        self.failUnless(sometrue(a,axis=0))
-        self.failUnlessEqual(sum(a[:3],axis=0), 0)
-        self.failUnlessEqual(product(a,axis=0), 0)
+        self.assertFalse(alltrue(a,axis=0))
+        self.assertTrue(sometrue(a,axis=0))
+        self.assertEqual(sum(a[:3],axis=0), 0)
+        self.assertEqual(product(a,axis=0), 0)
 
     def test_minmax(self):
         a = arange(1,13).reshape(3,4)
         amask = masked_where(a < 5,a)
-        self.failUnlessEqual(amask.max(), a.max())
-        self.failUnlessEqual(amask.min(), 5)
-        self.failUnless((amask.max(0) == a.max(0)).all())
-        self.failUnless((amask.min(0) == [5,6,7,8]).all())
-        self.failUnless(amask.max(1)[0].mask)
-        self.failUnless(amask.min(1)[0].mask)
+        self.assertEqual(amask.max(), a.max())
+        self.assertEqual(amask.min(), 5)
+        self.assertTrue((amask.max(0) == a.max(0)).all())
+        self.assertTrue((amask.min(0) == [5,6,7,8]).all())
+        self.assertTrue(amask.max(1)[0].mask)
+        self.assertTrue(amask.min(1)[0].mask)
 
     def test_nonzero(self):
         for t in "?bhilqpBHILQPfdgFDGO":
             x = array([1,0,2,0], mask=[0,0,1,1])
-            self.failUnless(eq(nonzero(x), [0]))
+            self.assertTrue(eq(nonzero(x), [0]))
 
 
 class TestArrayMethods(TestCase):
@@ -753,15 +753,15 @@
         (x,X,XX,m,mx,mX,mXX,) = self.d
         mXdiag = mX.diagonal()
         self.assertEqual(mX.trace(), mX.diagonal().compressed().sum())
-        self.failUnless(eq(mX.trace(),
+        self.assertTrue(eq(mX.trace(),
                            X.trace() - sum(mXdiag.mask*X.diagonal(),axis=0)))
 
     def test_clip(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
         clipped = mx.clip(2,8)
-        self.failUnless(eq(clipped.mask,mx.mask))
-        self.failUnless(eq(clipped._data,x.clip(2,8)))
-        self.failUnless(eq(clipped._data,mx._data.clip(2,8)))
+        self.assertTrue(eq(clipped.mask,mx.mask))
+        self.assertTrue(eq(clipped._data,x.clip(2,8)))
+        self.assertTrue(eq(clipped._data,mx._data.clip(2,8)))
 
     def test_ptp(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
@@ -773,13 +773,13 @@
             cols[k] = mX[:,k].compressed().ptp()
         for k in range(n):
             rows[k] = mX[k].compressed().ptp()
-        self.failUnless(eq(mX.ptp(0),cols))
-        self.failUnless(eq(mX.ptp(1),rows))
+        self.assertTrue(eq(mX.ptp(0),cols))
+        self.assertTrue(eq(mX.ptp(1),rows))
 
     def test_swapaxes(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
         mXswapped = mX.swapaxes(0,1)
-        self.failUnless(eq(mXswapped[-1],mX[:,-1]))
+        self.assertTrue(eq(mXswapped[-1],mX[:,-1]))
         mXXswapped = mXX.swapaxes(0,2)
         self.assertEqual(mXXswapped.shape,(2,2,3,3))
 
@@ -787,28 +787,28 @@
     def test_cumprod(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
         mXcp = mX.cumprod(0)
-        self.failUnless(eq(mXcp._data,mX.filled(1).cumprod(0)))
+        self.assertTrue(eq(mXcp._data,mX.filled(1).cumprod(0)))
         mXcp = mX.cumprod(1)
-        self.failUnless(eq(mXcp._data,mX.filled(1).cumprod(1)))
+        self.assertTrue(eq(mXcp._data,mX.filled(1).cumprod(1)))
 
     def test_cumsum(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
         mXcp = mX.cumsum(0)
-        self.failUnless(eq(mXcp._data,mX.filled(0).cumsum(0)))
+        self.assertTrue(eq(mXcp._data,mX.filled(0).cumsum(0)))
         mXcp = mX.cumsum(1)
-        self.failUnless(eq(mXcp._data,mX.filled(0).cumsum(1)))
+        self.assertTrue(eq(mXcp._data,mX.filled(0).cumsum(1)))
 
     def test_varstd(self):
         (x,X,XX,m,mx,mX,mXX,) = self.d
-        self.failUnless(eq(mX.var(axis=None),mX.compressed().var()))
-        self.failUnless(eq(mX.std(axis=None),mX.compressed().std()))
-        self.failUnless(eq(mXX.var(axis=3).shape,XX.var(axis=3).shape))
-        self.failUnless(eq(mX.var().shape,X.var().shape))
+        self.assertTrue(eq(mX.var(axis=None),mX.compressed().var()))
+        self.assertTrue(eq(mX.std(axis=None),mX.compressed().std()))
+        self.assertTrue(eq(mXX.var(axis=3).shape,XX.var(axis=3).shape))
+        self.assertTrue(eq(mX.var().shape,X.var().shape))
         (mXvar0,mXvar1) = (mX.var(axis=0), mX.var(axis=1))
         for k in range(6):
-            self.failUnless(eq(mXvar1[k],mX[k].compressed().var()))
-            self.failUnless(eq(mXvar0[k],mX[:,k].compressed().var()))
-            self.failUnless(eq(numpy.sqrt(mXvar0[k]),
+            self.assertTrue(eq(mXvar1[k],mX[k].compressed().var()))
+            self.assertTrue(eq(mXvar0[k],mX[:,k].compressed().var()))
+            self.assertTrue(eq(numpy.sqrt(mXvar0[k]),
                                mX[:,k].compressed().std()))
 
 

Modified: trunk/numpy/ma/tests/test_subclassing.py
===================================================================
--- trunk/numpy/ma/tests/test_subclassing.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/ma/tests/test_subclassing.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -81,40 +81,40 @@
         m = [0,0,1,0,0]
         xsub = SubArray(x)
         xmsub = masked_array(xsub, mask=m)
-        self.failUnless(isinstance(xmsub, MaskedArray))
+        self.assertTrue(isinstance(xmsub, MaskedArray))
         assert_equal(xmsub._data, xsub)
-        self.failUnless(isinstance(xmsub._data, SubArray))
+        self.assertTrue(isinstance(xmsub._data, SubArray))
 
     def test_maskedarray_subclassing(self):
         "Tests subclassing MaskedArray"
         (x, mx) = self.data
-        self.failUnless(isinstance(mx._data, np.matrix))
+        self.assertTrue(isinstance(mx._data, np.matrix))
 
     def test_masked_unary_operations(self):
         "Tests masked_unary_operation"
         (x, mx) = self.data
-        self.failUnless(isinstance(log(mx), mmatrix))
+        self.assertTrue(isinstance(log(mx), mmatrix))
         assert_equal(log(x), np.log(x))
 
     def test_masked_binary_operations(self):
         "Tests masked_binary_operation"
         (x, mx) = self.data
         # Result should be a mmatrix
-        self.failUnless(isinstance(add(mx,mx), mmatrix))
-        self.failUnless(isinstance(add(mx,x), mmatrix))
+        self.assertTrue(isinstance(add(mx,mx), mmatrix))
+        self.assertTrue(isinstance(add(mx,x), mmatrix))
         # Result should work
         assert_equal(add(mx,x), mx+x)
-        self.failUnless(isinstance(add(mx,mx)._data, np.matrix))
-        self.failUnless(isinstance(add.outer(mx,mx), mmatrix))
-        self.failUnless(isinstance(hypot(mx,mx), mmatrix))
-        self.failUnless(isinstance(hypot(mx,x), mmatrix))
+        self.assertTrue(isinstance(add(mx,mx)._data, np.matrix))
+        self.assertTrue(isinstance(add.outer(mx,mx), mmatrix))
+        self.assertTrue(isinstance(hypot(mx,mx), mmatrix))
+        self.assertTrue(isinstance(hypot(mx,x), mmatrix))
 
     def test_masked_binary_operations(self):
         "Tests domained_masked_binary_operation"
         (x, mx) = self.data
         xmx = masked_array(mx.data.__array__(), mask=mx.mask)
-        self.failUnless(isinstance(divide(mx,mx), mmatrix))
-        self.failUnless(isinstance(divide(mx,x), mmatrix))
+        self.assertTrue(isinstance(divide(mx,mx), mmatrix))
+        self.assertTrue(isinstance(divide(mx,x), mmatrix))
         assert_equal(divide(mx, mx), divide(xmx, xmx))
 
     def test_attributepropagation(self):
@@ -123,16 +123,16 @@
         ym = msubarray(x)
         #
         z = (my+1)
-        self.failUnless(isinstance(z,MaskedArray))
-        self.failUnless(not isinstance(z, MSubArray))
-        self.failUnless(isinstance(z._data, SubArray))
+        self.assertTrue(isinstance(z,MaskedArray))
+        self.assertTrue(not isinstance(z, MSubArray))
+        self.assertTrue(isinstance(z._data, SubArray))
         assert_equal(z._data.info, {})
         #
         z = (ym+1)
-        self.failUnless(isinstance(z, MaskedArray))
-        self.failUnless(isinstance(z, MSubArray))
-        self.failUnless(isinstance(z._data, SubArray))
-        self.failUnless(z._data.info['added'] > 0)
+        self.assertTrue(isinstance(z, MaskedArray))
+        self.assertTrue(isinstance(z, MSubArray))
+        self.assertTrue(isinstance(z._data, SubArray))
+        self.assertTrue(z._data.info['added'] > 0)
         #
         ym._set_mask([1,0,0,0,1])
         assert_equal(ym._mask, [1,0,0,0,1])
@@ -141,7 +141,7 @@
         #
         xsub = subarray(x, info={'name':'x'})
         mxsub = masked_array(xsub)
-        self.failUnless(hasattr(mxsub, 'info'))
+        self.assertTrue(hasattr(mxsub, 'info'))
         assert_equal(mxsub.info, xsub.info)
 
     def test_subclasspreservation(self):
@@ -152,22 +152,22 @@
         xsub = MSubArray(x, mask=m, info={'xsub':xinfo})
         #
         mxsub = masked_array(xsub, subok=False)
-        self.failUnless(not isinstance(mxsub, MSubArray))
-        self.failUnless(isinstance(mxsub, MaskedArray))
+        self.assertTrue(not isinstance(mxsub, MSubArray))
+        self.assertTrue(isinstance(mxsub, MaskedArray))
         assert_equal(mxsub._mask, m)
         #
         mxsub = asarray(xsub)
-        self.failUnless(not isinstance(mxsub, MSubArray))
-        self.failUnless(isinstance(mxsub, MaskedArray))
+        self.assertTrue(not isinstance(mxsub, MSubArray))
+        self.assertTrue(isinstance(mxsub, MaskedArray))
         assert_equal(mxsub._mask, m)
         #
         mxsub = masked_array(xsub, subok=True)
-        self.failUnless(isinstance(mxsub, MSubArray))
+        self.assertTrue(isinstance(mxsub, MSubArray))
         assert_equal(mxsub.info, xsub.info)
         assert_equal(mxsub._mask, xsub._mask)
         #
         mxsub = asanyarray(xsub)
-        self.failUnless(isinstance(mxsub, MSubArray))
+        self.assertTrue(isinstance(mxsub, MSubArray))
         assert_equal(mxsub.info, xsub.info)
         assert_equal(mxsub._mask, m)
 

Modified: trunk/numpy/matrixlib/tests/test_regression.py
===================================================================
--- trunk/numpy/matrixlib/tests/test_regression.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/matrixlib/tests/test_regression.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -23,7 +23,7 @@
         def mul() :
             np.mat(np.eye(2))*np.ones(2)
 
-        self.failUnlessRaises(ValueError,mul)
+        self.assertRaises(ValueError,mul)
 
     def test_matrix_std_argmax(self,level=rlevel):
         """Ticket #83"""

Modified: trunk/numpy/testing/tests/test_utils.py
===================================================================
--- trunk/numpy/testing/tests/test_utils.py	2010-02-20 18:22:04 UTC (rev 8194)
+++ trunk/numpy/testing/tests/test_utils.py	2010-02-20 22:31:25 UTC (rev 8195)
@@ -174,7 +174,7 @@
 
         self._assert_func(x, y, decimal=3)
         self._assert_func(x, y, decimal=4)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda: self._assert_func(x, y, decimal=5))
 
     def test_nan(self):
@@ -182,11 +182,11 @@
         aone = np.array([1])
         ainf = np.array([np.inf])
         self._assert_func(anan, anan)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, aone))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, ainf))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(ainf, anan))
 
 class TestAlmostEqual(_GenericTest, unittest.TestCase):
@@ -195,11 +195,11 @@
 
     def test_nan_item(self):
         self._assert_func(np.nan, np.nan)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(np.nan, 1))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(np.nan, np.inf))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(np.inf, np.nan))
 
     def test_inf_item(self):
@@ -235,7 +235,7 @@
 
         self._assert_func(x, y, significant=5)
         self._assert_func(x, y, significant=6)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda: self._assert_func(x, y, significant=7))
 
     def test_simple_items(self):
@@ -245,7 +245,7 @@
         self._assert_func(x, y, significant=4)
         self._assert_func(x, y, significant=5)
         self._assert_func(x, y, significant=6)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda: self._assert_func(x, y, significant=7))
 
     def test_nan_array(self):
@@ -253,11 +253,11 @@
         aone = np.array(1)
         ainf = np.array(np.inf)
         self._assert_func(anan, anan)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, aone))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, ainf))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(ainf, anan))
 
     def test_nan_items(self):
@@ -265,11 +265,11 @@
         aone = np.array(1)
         ainf = np.array(np.inf)
         self._assert_func(anan, anan)
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, aone))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(anan, ainf))
-        self.failUnlessRaises(AssertionError,
+        self.assertRaises(AssertionError,
                 lambda : self._assert_func(ainf, anan))
 
 class TestRaises(unittest.TestCase):
@@ -349,7 +349,7 @@
         def failure():
             return assert_array_almost_equal_nulp(x, y,
                                                   nulp=1000)
-        self.failUnlessRaises(AssertionError, failure)
+        self.assertRaises(AssertionError, failure)
 
     def test_big_float32(self):
         x = (1e10 * np.random.randn(10)).astype(np.float32)
@@ -361,14 +361,14 @@
         y = x + 1
         def failure():
             assert_array_almost_equal_nulp(x, y, nulp=1000)
-        self.failUnlessRaises(AssertionError, failure)
+        self.assertRaises(AssertionError, failure)
 
     def test_complex(self):
         x = np.random.randn(10) + 1j * np.random.randn(10)
         y = x + 1
         def failure():
             assert_array_almost_equal_nulp(x, y, nulp=1000)
-        self.failUnlessRaises(AssertionError, failure)
+        self.assertRaises(AssertionError, failure)
 
     def test_complex2(self):
         x = np.random.randn(10)
@@ -414,19 +414,19 @@
             tiny = np.array([np.finfo(dt).tiny])
             zero = np.array([np.PZERO]).astype(dt)
             nzero = np.array([np.NZERO]).astype(dt)
-            self.failUnlessRaises(AssertionError,
+            self.assertRaises(AssertionError,
                                   lambda: assert_array_max_ulp(nan, inf,
                                                                maxulp=maxulp))
-            self.failUnlessRaises(AssertionError,
+            self.assertRaises(AssertionError,
                                   lambda: assert_array_max_ulp(nan, big,
                                                                maxulp=maxulp))
-            self.failUnlessRaises(AssertionError,
+            self.assertRaises(AssertionError,
                                   lambda: assert_array_max_ulp(nan, tiny,
                                                                maxulp=maxulp))
-            self.failUnlessRaises(AssertionError,
+            self.assertRaises(AssertionError,
                                   lambda: assert_array_max_ulp(nan, zero,
                                                                maxulp=maxulp))
-            self.failUnlessRaises(AssertionError,
+            self.assertRaises(AssertionError,
                                   lambda: assert_array_max_ulp(nan, nzero,
                                                                maxulp=maxulp))
 if __name__ == '__main__':



More information about the Numpy-svn mailing list