[Numpy-svn] r8196 - in trunk/numpy: core/tests distutils/tests fft/tests lib/tests

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 19:55:28 CST 2010


Author: charris
Date: 2010-02-20 19:55:27 -0600 (Sat, 20 Feb 2010)
New Revision: 8196

Modified:
   trunk/numpy/core/tests/test_datetime.py
   trunk/numpy/core/tests/test_defchararray.py
   trunk/numpy/core/tests/test_dtype.py
   trunk/numpy/core/tests/test_multiarray.py
   trunk/numpy/core/tests/test_numeric.py
   trunk/numpy/core/tests/test_numerictypes.py
   trunk/numpy/core/tests/test_records.py
   trunk/numpy/core/tests/test_regression.py
   trunk/numpy/core/tests/test_umath.py
   trunk/numpy/distutils/tests/test_npy_pkg_config.py
   trunk/numpy/fft/tests/test_fftpack.py
   trunk/numpy/lib/tests/test_function_base.py
Log:
DEP: Fix more files for unittest deprecated functions. It isn't clear why these
tests didn't issue deprecation warnings. Are they being run?

Modified: trunk/numpy/core/tests/test_datetime.py
===================================================================
--- trunk/numpy/core/tests/test_datetime.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_datetime.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -52,8 +52,8 @@
 
     def test_divisor_conversion_fs(self):
         assert np.dtype('M8[fs/100]') == np.dtype('M8[10as]')
-        self.failUnlessRaises(ValueError, lambda : np.dtype('M8[3fs/10000]'))
+        self.assertRaises(ValueError, lambda : np.dtype('M8[3fs/10000]'))
 
     def test_divisor_conversion_as(self):
-        self.failUnlessRaises(ValueError, lambda : np.dtype('M8[as/10]'))
+        self.assertRaises(ValueError, lambda : np.dtype('M8[as/10]'))
 

Modified: trunk/numpy/core/tests/test_defchararray.py
===================================================================
--- trunk/numpy/core/tests/test_defchararray.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_defchararray.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -21,7 +21,7 @@
     def test_from_object_array_unicode(self):
         A = np.array([['abc', u'Sigma \u03a3'],
                       ['long   ', '0123456789']], dtype='O')
-        self.failUnlessRaises(ValueError, np.char.array, (A,))
+        self.assertRaises(ValueError, np.char.array, (A,))
         B = np.char.array(A, **kw_unicode_true)
         assert_equal(B.dtype.itemsize, 10 * np.array('a', 'U').dtype.itemsize)
         assert_array_equal(B, [['abc', u'Sigma \u03a3'],
@@ -58,7 +58,7 @@
         assert_equal(B.shape, A.shape)
         def fail():
             B = np.char.array(A, **kw_unicode_false)
-        self.failUnlessRaises(UnicodeEncodeError, fail)
+        self.assertRaises(UnicodeEncodeError, fail)
 
     def test_unicode_upconvert(self):
         A = np.char.array(['abc'])
@@ -82,37 +82,37 @@
     def test_non_existent_method(self):
         def fail():
             _vec_string('a', np.string_, 'bogus')
-        self.failUnlessRaises(AttributeError, fail)
+        self.assertRaises(AttributeError, fail)
 
     def test_non_string_array(self):
         def fail():
             _vec_string(1, np.string_, 'strip')
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_invalid_args_tuple(self):
         def fail():
             _vec_string(['a'], np.string_, 'strip', 1)
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_invalid_type_descr(self):
         def fail():
             _vec_string(['a'], 'BOGUS', 'strip')
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_invalid_function_args(self):
         def fail():
             _vec_string(['a'], np.string_, 'strip', (1,))
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_invalid_result_type(self):
         def fail():
             _vec_string(['a'], np.integer, 'strip')
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_broadcast_error(self):
         def fail():
             _vec_string([['abc', 'def']], np.integer, 'find', (['a', 'd', 'j'],))
-        self.failUnlessRaises(ValueError, fail)
+        self.assertRaises(ValueError, fail)
 
 
 class TestWhitespace(TestCase):
@@ -210,7 +210,7 @@
         assert_array_equal(self.A.endswith('3', 0, 3), [[0, 0], [1, 0], [1, 0]])
         def fail():
             self.A.endswith('3', 'fdjk')
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
     def test_find(self):
         assert issubclass(self.A.find('a').dtype.type, np.integer)
@@ -222,7 +222,7 @@
     def test_index(self):
         def fail():
             self.A.index('a')
-        self.failUnlessRaises(ValueError, fail)
+        self.assertRaises(ValueError, fail)
         assert np.char.index('abcba', 'b') == 1
         assert issubclass(np.char.index('abcba', 'b').dtype.type, np.integer)
 
@@ -264,7 +264,7 @@
     def test_rindex(self):
         def fail():
             self.A.rindex('a')
-        self.failUnlessRaises(ValueError, fail)
+        self.assertRaises(ValueError, fail)
         assert np.char.rindex('abcba', 'b') == 3
         assert issubclass(np.char.rindex('abcba', 'b').dtype.type, np.integer)
 
@@ -274,7 +274,7 @@
         assert_array_equal(self.A.startswith('1', 0, 3), [[0, 0], [1, 0], [1, 0]])
         def fail():
             self.A.startswith('3', 'fdjk')
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
 
 
 class TestMethods(TestCase):
@@ -538,7 +538,7 @@
     def test_isnumeric(self):
         def fail():
             self.A.isnumeric()
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
         assert issubclass(self.B.isnumeric().dtype.type, np.bool_)
         assert_array_equal(self.B.isnumeric(), [
                 [False, False], [True, False], [False, False]])
@@ -546,7 +546,7 @@
     def test_isdecimal(self):
         def fail():
             self.A.isdecimal()
-        self.failUnlessRaises(TypeError, fail)
+        self.assertRaises(TypeError, fail)
         assert issubclass(self.B.isdecimal().dtype.type, np.bool_)
         assert_array_equal(self.B.isdecimal(), [
                 [False, False], [True, False], [False, False]])

Modified: trunk/numpy/core/tests/test_dtype.py
===================================================================
--- trunk/numpy/core/tests/test_dtype.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_dtype.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -14,14 +14,14 @@
         """Test whether equivalent record dtypes hash the same."""
         a = np.dtype([('yo', np.int)])
         b = np.dtype([('yo', np.int)])
-        self.failUnless(hash(a) == hash(b), 
+        self.assertTrue(hash(a) == hash(b), 
                 "two equivalent types do not hash to the same value !")
 
     def test_different_names(self):
         # In theory, they may hash the same (collision) ?
         a = np.dtype([('yo', np.int)])
         b = np.dtype([('ye', np.int)])
-        self.failUnless(hash(a) != hash(b),
+        self.assertTrue(hash(a) != hash(b),
                 "%s and %s hash the same !" % (a, b))
 
     def test_different_titles(self):
@@ -30,38 +30,38 @@
             'titles': ['Red pixel', 'Blue pixel']})
         b = np.dtype({'names': ['r','b'], 'formats': ['u1', 'u1'],
             'titles': ['RRed pixel', 'Blue pixel']})
-        self.failUnless(hash(a) != hash(b),
+        self.assertTrue(hash(a) != hash(b),
                 "%s and %s hash the same !" % (a, b))
 
 class TestSubarray(TestCase):
     def test_single_subarray(self):
         a = np.dtype((np.int, (2)))
         b = np.dtype((np.int, (2,)))
-        self.failUnless(hash(a) == hash(b), 
+        self.assertTrue(hash(a) == hash(b), 
                 "two equivalent types do not hash to the same value !")
 
     def test_equivalent_record(self):
         """Test whether equivalent subarray dtypes hash the same."""
         a = np.dtype((np.int, (2, 3)))
         b = np.dtype((np.int, (2, 3)))
-        self.failUnless(hash(a) == hash(b), 
+        self.assertTrue(hash(a) == hash(b), 
                 "two equivalent types do not hash to the same value !")
 
     def test_nonequivalent_record(self):
         """Test whether different subarray dtypes hash differently."""
         a = np.dtype((np.int, (2, 3)))
         b = np.dtype((np.int, (3, 2)))
-        self.failUnless(hash(a) != hash(b), 
+        self.assertTrue(hash(a) != hash(b), 
                 "%s and %s hash the same !" % (a, b))
 
         a = np.dtype((np.int, (2, 3)))
         b = np.dtype((np.int, (2, 2)))
-        self.failUnless(hash(a) != hash(b), 
+        self.assertTrue(hash(a) != hash(b), 
                 "%s and %s hash the same !" % (a, b))
 
         a = np.dtype((np.int, (1, 2, 3)))
         b = np.dtype((np.int, (1, 2)))
-        self.failUnless(hash(a) != hash(b), 
+        self.assertTrue(hash(a) != hash(b), 
                 "%s and %s hash the same !" % (a, b))
 
 class TestMonsterType(TestCase):
@@ -73,13 +73,13 @@
             ('yi', np.dtype((np.int, (3, 2))))])
         b = np.dtype([('yo', np.int), ('ye', simple1),
             ('yi', np.dtype((np.int, (3, 2))))])
-        self.failUnless(hash(a) == hash(b))
+        self.assertTrue(hash(a) == hash(b))
 
         c = np.dtype([('yo', np.int), ('ye', simple1),
             ('yi', np.dtype((a, (3, 2))))])
         d = np.dtype([('yo', np.int), ('ye', simple1),
             ('yi', np.dtype((a, (3, 2))))])
-        self.failUnless(hash(c) == hash(d))
+        self.assertTrue(hash(c) == hash(d))
 
 class TestMetadata(TestCase):
     def test_no_metadata(self):

Modified: trunk/numpy/core/tests/test_multiarray.py
===================================================================
--- trunk/numpy/core/tests/test_multiarray.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_multiarray.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -66,7 +66,7 @@
         assert_equal(self.three.dtype, dtype(float_))
         assert_equal(self.one.dtype.char, 'l')
         assert_equal(self.three.dtype.char, 'd')
-        self.failUnless(self.three.dtype.str[0] in '<>')
+        self.assertTrue(self.three.dtype.str[0] in '<>')
         assert_equal(self.one.dtype.str[1], 'i')
         assert_equal(self.three.dtype.str[1], 'f')
 
@@ -77,11 +77,11 @@
                            offset=offset*x.itemsize,
                            strides=strides*x.itemsize)
         assert_equal(make_array(4, 4, -1), array([4, 3, 2, 1]))
-        self.failUnlessRaises(ValueError, make_array, 4, 4, -2)
-        self.failUnlessRaises(ValueError, make_array, 4, 2, -1)
-        self.failUnlessRaises(ValueError, make_array, 8, 3, 1)
-        #self.failUnlessRaises(ValueError, make_array, 8, 3, 0)
-        #self.failUnlessRaises(ValueError, lambda: ndarray([1], strides=4))
+        self.assertRaises(ValueError, make_array, 4, 4, -2)
+        self.assertRaises(ValueError, make_array, 4, 2, -1)
+        self.assertRaises(ValueError, make_array, 8, 3, 1)
+        #self.assertRaises(ValueError, make_array, 8, 3, 0)
+        #self.assertRaises(ValueError, lambda: ndarray([1], strides=4))
 
 
     def test_set_stridesattr(self):
@@ -95,10 +95,10 @@
             return r
         assert_equal(make_array(4, 4, -1), array([4, 3, 2, 1]))
         assert_equal(make_array(7,3,1), array([3, 4, 5, 6, 7, 8, 9]))
-        self.failUnlessRaises(ValueError, make_array, 4, 4, -2)
-        self.failUnlessRaises(ValueError, make_array, 4, 2, -1)
-        self.failUnlessRaises(RuntimeError, make_array, 8, 3, 1)
-        #self.failUnlessRaises(ValueError, make_array, 8, 3, 0)
+        self.assertRaises(ValueError, make_array, 4, 4, -2)
+        self.assertRaises(ValueError, make_array, 4, 2, -1)
+        self.assertRaises(RuntimeError, make_array, 8, 3, 1)
+        #self.assertRaises(ValueError, make_array, 8, 3, 0)
 
     def test_fill(self):
         for t in "?bhilqpBHILQPfdgFDGO":
@@ -126,75 +126,75 @@
 
     def test_ellipsis_subscript(self):
         a,b = self.d
-        self.failUnlessEqual(a[...], 0)
-        self.failUnlessEqual(b[...], 'x')
-        self.failUnless(a[...] is a)
-        self.failUnless(b[...] is b)
+        self.assertEqual(a[...], 0)
+        self.assertEqual(b[...], 'x')
+        self.assertTrue(a[...] is a)
+        self.assertTrue(b[...] is b)
 
     def test_empty_subscript(self):
         a,b = self.d
-        self.failUnlessEqual(a[()], 0)
-        self.failUnlessEqual(b[()], 'x')
-        self.failUnless(type(a[()]) is a.dtype.type)
-        self.failUnless(type(b[()]) is str)
+        self.assertEqual(a[()], 0)
+        self.assertEqual(b[()], 'x')
+        self.assertTrue(type(a[()]) is a.dtype.type)
+        self.assertTrue(type(b[()]) is str)
 
     def test_invalid_subscript(self):
         a,b = self.d
-        self.failUnlessRaises(IndexError, lambda x: x[0], a)
-        self.failUnlessRaises(IndexError, lambda x: x[0], b)
-        self.failUnlessRaises(IndexError, lambda x: x[array([], int)], a)
-        self.failUnlessRaises(IndexError, lambda x: x[array([], int)], b)
+        self.assertRaises(IndexError, lambda x: x[0], a)
+        self.assertRaises(IndexError, lambda x: x[0], b)
+        self.assertRaises(IndexError, lambda x: x[array([], int)], a)
+        self.assertRaises(IndexError, lambda x: x[array([], int)], b)
 
     def test_ellipsis_subscript_assignment(self):
         a,b = self.d
         a[...] = 42
-        self.failUnlessEqual(a, 42)
+        self.assertEqual(a, 42)
         b[...] = ''
-        self.failUnlessEqual(b.item(), '')
+        self.assertEqual(b.item(), '')
 
     def test_empty_subscript_assignment(self):
         a,b = self.d
         a[()] = 42
-        self.failUnlessEqual(a, 42)
+        self.assertEqual(a, 42)
         b[()] = ''
-        self.failUnlessEqual(b.item(), '')
+        self.assertEqual(b.item(), '')
 
     def test_invalid_subscript_assignment(self):
         a,b = self.d
         def assign(x, i, v):
             x[i] = v
-        self.failUnlessRaises(IndexError, assign, a, 0, 42)
-        self.failUnlessRaises(IndexError, assign, b, 0, '')
-        self.failUnlessRaises(ValueError, assign, a, (), '')
+        self.assertRaises(IndexError, assign, a, 0, 42)
+        self.assertRaises(IndexError, assign, b, 0, '')
+        self.assertRaises(ValueError, assign, a, (), '')
 
     def test_newaxis(self):
         a,b = self.d
-        self.failUnlessEqual(a[newaxis].shape, (1,))
-        self.failUnlessEqual(a[..., newaxis].shape, (1,))
-        self.failUnlessEqual(a[newaxis, ...].shape, (1,))
-        self.failUnlessEqual(a[..., newaxis].shape, (1,))
-        self.failUnlessEqual(a[newaxis, ..., newaxis].shape, (1,1))
-        self.failUnlessEqual(a[..., newaxis, newaxis].shape, (1,1))
-        self.failUnlessEqual(a[newaxis, newaxis, ...].shape, (1,1))
-        self.failUnlessEqual(a[(newaxis,)*10].shape, (1,)*10)
+        self.assertEqual(a[newaxis].shape, (1,))
+        self.assertEqual(a[..., newaxis].shape, (1,))
+        self.assertEqual(a[newaxis, ...].shape, (1,))
+        self.assertEqual(a[..., newaxis].shape, (1,))
+        self.assertEqual(a[newaxis, ..., newaxis].shape, (1,1))
+        self.assertEqual(a[..., newaxis, newaxis].shape, (1,1))
+        self.assertEqual(a[newaxis, newaxis, ...].shape, (1,1))
+        self.assertEqual(a[(newaxis,)*10].shape, (1,)*10)
 
     def test_invalid_newaxis(self):
         a,b = self.d
         def subscript(x, i): x[i]
-        self.failUnlessRaises(IndexError, subscript, a, (newaxis, 0))
-        self.failUnlessRaises(IndexError, subscript, a, (newaxis,)*50)
+        self.assertRaises(IndexError, subscript, a, (newaxis, 0))
+        self.assertRaises(IndexError, subscript, a, (newaxis,)*50)
 
     def test_constructor(self):
         x = ndarray(())
         x[()] = 5
-        self.failUnlessEqual(x[()], 5)
+        self.assertEqual(x[()], 5)
         y = ndarray((),buffer=x)
         y[()] = 6
-        self.failUnlessEqual(x[()], 6)
+        self.assertEqual(x[()], 6)
 
     def test_output(self):
         x = array(2)
-        self.failUnlessRaises(ValueError, add, x, [1], x)
+        self.assertRaises(ValueError, add, x, [1], x)
 
 
 class TestScalarIndexing(TestCase):
@@ -203,41 +203,41 @@
 
     def test_ellipsis_subscript(self):
         a = self.d
-        self.failUnlessEqual(a[...], 0)
-        self.failUnlessEqual(a[...].shape,())
+        self.assertEqual(a[...], 0)
+        self.assertEqual(a[...].shape,())
 
     def test_empty_subscript(self):
         a = self.d
-        self.failUnlessEqual(a[()], 0)
-        self.failUnlessEqual(a[()].shape,())
+        self.assertEqual(a[()], 0)
+        self.assertEqual(a[()].shape,())
 
     def test_invalid_subscript(self):
         a = self.d
-        self.failUnlessRaises(IndexError, lambda x: x[0], a)
-        self.failUnlessRaises(IndexError, lambda x: x[array([], int)], a)
+        self.assertRaises(IndexError, lambda x: x[0], a)
+        self.assertRaises(IndexError, lambda x: x[array([], int)], a)
 
     def test_invalid_subscript_assignment(self):
         a = self.d
         def assign(x, i, v):
             x[i] = v
-        self.failUnlessRaises(TypeError, assign, a, 0, 42)
+        self.assertRaises(TypeError, assign, a, 0, 42)
 
     def test_newaxis(self):
         a = self.d
-        self.failUnlessEqual(a[newaxis].shape, (1,))
-        self.failUnlessEqual(a[..., newaxis].shape, (1,))
-        self.failUnlessEqual(a[newaxis, ...].shape, (1,))
-        self.failUnlessEqual(a[..., newaxis].shape, (1,))
-        self.failUnlessEqual(a[newaxis, ..., newaxis].shape, (1,1))
-        self.failUnlessEqual(a[..., newaxis, newaxis].shape, (1,1))
-        self.failUnlessEqual(a[newaxis, newaxis, ...].shape, (1,1))
-        self.failUnlessEqual(a[(newaxis,)*10].shape, (1,)*10)
+        self.assertEqual(a[newaxis].shape, (1,))
+        self.assertEqual(a[..., newaxis].shape, (1,))
+        self.assertEqual(a[newaxis, ...].shape, (1,))
+        self.assertEqual(a[..., newaxis].shape, (1,))
+        self.assertEqual(a[newaxis, ..., newaxis].shape, (1,1))
+        self.assertEqual(a[..., newaxis, newaxis].shape, (1,1))
+        self.assertEqual(a[newaxis, newaxis, ...].shape, (1,1))
+        self.assertEqual(a[(newaxis,)*10].shape, (1,)*10)
 
     def test_invalid_newaxis(self):
         a = self.d
         def subscript(x, i): x[i]
-        self.failUnlessRaises(IndexError, subscript, a, (newaxis, 0))
-        self.failUnlessRaises(IndexError, subscript, a, (newaxis,)*50)
+        self.assertRaises(IndexError, subscript, a, (newaxis, 0))
+        self.assertRaises(IndexError, subscript, a, (newaxis,)*50)
 
 
 class TestCreation(TestCase):
@@ -245,7 +245,7 @@
         class x(object):
             def __array__(self, dtype=None):
                 pass
-        self.failUnlessRaises(ValueError, array, x())
+        self.assertRaises(ValueError, array, x())
 
     def test_from_string(self) :
         types = np.typecodes['AllInteger'] + np.typecodes['Float']
@@ -260,12 +260,12 @@
     def test_test_interning(self):
         a0 = bool_(0)
         b0 = bool_(False)
-        self.failUnless(a0 is b0)
+        self.assertTrue(a0 is b0)
         a1 = bool_(1)
         b1 = bool_(True)
-        self.failUnless(a1 is b1)
-        self.failUnless(array([True])[0] is a1)
-        self.failUnless(array(True)[()] is a1)
+        self.assertTrue(a1 is b1)
+        self.assertTrue(array([True])[0] is a1)
+        self.assertTrue(array(True)[()] is a1)
 
 
 class TestMethods(TestCase):
@@ -278,9 +278,9 @@
     def test_transpose(self):
         a = array([[1,2],[3,4]])
         assert_equal(a.transpose(), [[1,3],[2,4]])
-        self.failUnlessRaises(ValueError, lambda: a.transpose(0))
-        self.failUnlessRaises(ValueError, lambda: a.transpose(0,0))
-        self.failUnlessRaises(ValueError, lambda: a.transpose(0,1,2))
+        self.assertRaises(ValueError, lambda: a.transpose(0))
+        self.assertRaises(ValueError, lambda: a.transpose(0,0))
+        self.assertRaises(ValueError, lambda: a.transpose(0,1,2))
 
     def test_sort(self):
         # test ordering for floats and complex containing nans. It is only
@@ -545,10 +545,10 @@
 class TestSubscripting(TestCase):
     def test_test_zero_rank(self):
         x = array([1,2,3])
-        self.failUnless(isinstance(x[0], np.int_))
+        self.assertTrue(isinstance(x[0], np.int_))
         if sys.version_info[0] < 3:
-            self.failUnless(isinstance(x[0], int))
-        self.failUnless(type(x[0, ...]) is ndarray)
+            self.assertTrue(isinstance(x[0], int))
+        self.assertTrue(type(x[0, ...]) is ndarray)
 
 
 class TestPickling(TestCase):
@@ -774,7 +774,7 @@
                         yield self.tst_basic,x.copy().astype(T),T,mask,val
 
     def test_mask_size(self):
-        self.failUnlessRaises(ValueError, np.putmask,
+        self.assertRaises(ValueError, np.putmask,
                               np.array([1,2,3]), [True], 5)
 
     def tst_byteorder(self,dtype):
@@ -820,8 +820,8 @@
     def test_raise(self):
         x = np.random.random(24)*100
         x.shape = 2,3,4
-        self.failUnlessRaises(IndexError, x.take, [0,1,2], axis=0)
-        self.failUnlessRaises(IndexError, x.take, [-3], axis=0)
+        self.assertRaises(IndexError, x.take, [0,1,2], axis=0)
+        self.assertRaises(IndexError, x.take, [-3], axis=0)
         assert_array_equal(x.take([-1], axis=0)[0], x[1])
 
     def test_clip(self):
@@ -1048,7 +1048,7 @@
     def test_check_reference(self):
         x = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
         y = x
-        self.failUnlessRaises(ValueError,x.resize,(5,1))
+        self.assertRaises(ValueError,x.resize,(5,1))
 
 
 class TestRecord(TestCase):
@@ -1258,7 +1258,7 @@
         r = np.array([[2, 1, 1, 2, 3], [1, 1, 2, 3, 4], [1, 2, 3, 4, 5],
                 [2, 3, 4, 5, 5], [3, 4, 5, 5, 4]], dtype=dt)
         l = test_neighborhood_iterator(x, [-2, 2], x[1], NEIGH_MODE['mirror'])
-        self.failUnless([i.dtype == dt for i in l])
+        self.assertTrue([i.dtype == dt for i in l])
         assert_array_equal(l, r)
 
     def test_mirror(self):

Modified: trunk/numpy/core/tests/test_numeric.py
===================================================================
--- trunk/numpy/core/tests/test_numeric.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_numeric.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -192,46 +192,46 @@
         f = False_
         t = True_
         s = "xyz"
-        self.failUnless((t and s) is s)
-        self.failUnless((f and s) is f)
+        self.assertTrue((t and s) is s)
+        self.assertTrue((f and s) is f)
 
     def test_bitwise_or(self):
         f = False_
         t = True_
-        self.failUnless((t | t) is t)
-        self.failUnless((f | t) is t)
-        self.failUnless((t | f) is t)
-        self.failUnless((f | f) is f)
+        self.assertTrue((t | t) is t)
+        self.assertTrue((f | t) is t)
+        self.assertTrue((t | f) is t)
+        self.assertTrue((f | f) is f)
 
     def test_bitwise_and(self):
         f = False_
         t = True_
-        self.failUnless((t & t) is t)
-        self.failUnless((f & t) is f)
-        self.failUnless((t & f) is f)
-        self.failUnless((f & f) is f)
+        self.assertTrue((t & t) is t)
+        self.assertTrue((f & t) is f)
+        self.assertTrue((t & f) is f)
+        self.assertTrue((f & f) is f)
 
     def test_bitwise_xor(self):
         f = False_
         t = True_
-        self.failUnless((t ^ t) is f)
-        self.failUnless((f ^ t) is t)
-        self.failUnless((t ^ f) is t)
-        self.failUnless((f ^ f) is f)
+        self.assertTrue((t ^ t) is f)
+        self.assertTrue((f ^ t) is t)
+        self.assertTrue((t ^ f) is t)
+        self.assertTrue((f ^ f) is f)
 
 
 class TestSeterr(TestCase):
     def test_set(self):
         err = seterr()
         old = seterr(divide='warn')
-        self.failUnless(err == old)
+        self.assertTrue(err == old)
         new = seterr()
-        self.failUnless(new['divide'] == 'warn')
+        self.assertTrue(new['divide'] == 'warn')
         seterr(over='raise')
-        self.failUnless(geterr()['over'] == 'raise')
-        self.failUnless(new['divide'] == 'warn')
+        self.assertTrue(geterr()['over'] == 'raise')
+        self.assertTrue(new['divide'] == 'warn')
         seterr(**old)
-        self.failUnless(geterr() == old)
+        self.assertTrue(geterr() == old)
 
     def test_divide_err(self):
         seterr(divide='raise')
@@ -254,16 +254,16 @@
         ai32 = fromiter(self.makegen(), int32)
         ai64 = fromiter(self.makegen(), int64)
         af = fromiter(self.makegen(), float)
-        self.failUnless(ai32.dtype == dtype(int32))
-        self.failUnless(ai64.dtype == dtype(int64))
-        self.failUnless(af.dtype == dtype(float))
+        self.assertTrue(ai32.dtype == dtype(int32))
+        self.assertTrue(ai64.dtype == dtype(int64))
+        self.assertTrue(af.dtype == dtype(float))
 
     def test_lengths(self):
         expected = array(list(self.makegen()))
         a = fromiter(self.makegen(), int)
         a20 = fromiter(self.makegen(), int, 20)
-        self.failUnless(len(a) == len(expected))
-        self.failUnless(len(a20) == 20)
+        self.assertTrue(len(a) == len(expected))
+        self.assertTrue(len(a20) == 20)
         try:
             fromiter(self.makegen(), int, len(expected) + 10)
         except ValueError:
@@ -275,8 +275,8 @@
         expected = array(list(self.makegen()))
         a = fromiter(self.makegen(), int)
         a20 = fromiter(self.makegen(), int, 20)
-        self.failUnless(alltrue(a == expected,axis=0))
-        self.failUnless(alltrue(a20 == expected[:20],axis=0))
+        self.assertTrue(alltrue(a == expected,axis=0))
+        self.assertTrue(alltrue(a20 == expected[:20],axis=0))
 
 
 class TestIndex(TestCase):

Modified: trunk/numpy/core/tests/test_numerictypes.py
===================================================================
--- trunk/numpy/core/tests/test_numerictypes.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_numerictypes.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -360,7 +360,7 @@
     def _bad_call(self):
         return self.ary['f0','f1']
     def test_no_tuple(self):
-        self.failUnlessRaises(ValueError, self._bad_call)
+        self.assertRaises(ValueError, self._bad_call)
     def test_return(self):
         res = self.ary[['f0','f2']].tolist()
         assert(res == [(1,3), (5,7)])        

Modified: trunk/numpy/core/tests/test_records.py
===================================================================
--- trunk/numpy/core/tests/test_records.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_records.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -129,7 +129,7 @@
         a = self.data
         def assign_invalid_column(x):
             x[0].col5 = 1
-        self.failUnlessRaises(AttributeError, assign_invalid_column, a)
+        self.assertRaises(AttributeError, assign_invalid_column, a)
 
 
 def test_find_duplicate():

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_regression.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -84,7 +84,7 @@
         b = a[:,:2,]
         def rs():
             b.shape = (10,)
-        self.failUnlessRaises(AttributeError,rs)
+        self.assertRaises(AttributeError,rs)
 
     def test_bool(self,level=rlevel):
         """Ticket #60"""
@@ -133,15 +133,15 @@
 
     def test_mem_dtype_align(self,level=rlevel):
         """Ticket #93"""
-        self.failUnlessRaises(TypeError,np.dtype,
+        self.assertRaises(TypeError,np.dtype,
                               {'names':['a'],'formats':['foo']},align=1)
 
     def test_intp(self,level=rlevel):
         """Ticket #99"""
         i_width = np.int_(0).nbytes*2 - 1
         np.intp('0x' + 'f'*i_width,16)
-        self.failUnlessRaises(OverflowError,np.intp,'0x' + 'f'*(i_width+1),16)
-        self.failUnlessRaises(ValueError,np.intp,'0x1',32)
+        self.assertRaises(OverflowError,np.intp,'0x' + 'f'*(i_width+1),16)
+        self.assertRaises(ValueError,np.intp,'0x1',32)
         assert_equal(255,np.intp('0xFF',16))
         assert_equal(1024,np.intp(1024))
 
@@ -196,7 +196,7 @@
         """Ticket #128"""
         x = np.arange(9).reshape((3,3))
         y = np.array([0,0,0])
-        self.failUnlessRaises(ValueError,np.hstack,(x,y))
+        self.assertRaises(ValueError,np.hstack,(x,y))
 
     def test_squeeze_type(self,level=rlevel):
         """Ticket #133"""
@@ -246,8 +246,8 @@
         x = np.empty((3,1))
         def bfa(): x[:] = np.arange(3)
         def bfb(): x[:] = np.arange(3,dtype=float)
-        self.failUnlessRaises(ValueError, bfa)
-        self.failUnlessRaises(ValueError, bfb)
+        self.assertRaises(ValueError, bfa)
+        self.assertRaises(ValueError, bfb)
 
     def test_unpickle_dtype_with_object(self,level=rlevel):
         """Implemented in r2840"""
@@ -263,7 +263,7 @@
         """Ticket #196"""
         dt = np.dtype([('x',int),('y',np.object_)])
         # Wrong way
-        self.failUnlessRaises(ValueError, np.array, [1,'object'], dt)
+        self.assertRaises(ValueError, np.array, [1,'object'], dt)
         # Correct way
         np.array([(1,'object')],dt)
 
@@ -279,7 +279,7 @@
         """Ticket #205"""
         tmp = np.array([])
         def index_tmp(): tmp[np.array(10)]
-        self.failUnlessRaises(IndexError, index_tmp)
+        self.assertRaises(IndexError, index_tmp)
 
     def test_chararray_rstrip(self,level=rlevel):
         """Ticket #222"""
@@ -442,7 +442,7 @@
 
     def test_string_array_size(self, level=rlevel):
         """Ticket #342"""
-        self.failUnlessRaises(ValueError,
+        self.assertRaises(ValueError,
                               np.array,[['X'],['X','X','X']],'|S1')
 
     def test_dtype_repr(self, level=rlevel):
@@ -513,8 +513,8 @@
 
     def test_convolve_empty(self, level=rlevel):
         """Convolve should raise an error for empty input array."""
-        self.failUnlessRaises(ValueError,np.convolve,[],[1])
-        self.failUnlessRaises(ValueError,np.convolve,[1],[])
+        self.assertRaises(ValueError,np.convolve,[],[1])
+        self.assertRaises(ValueError,np.convolve,[1],[])
 
     def test_multidim_byteswap(self, level=rlevel):
         """Ticket #449"""
@@ -592,7 +592,7 @@
 
     def test_mem_on_invalid_dtype(self):
         "Ticket #583"
-        self.failUnlessRaises(ValueError, np.fromiter, [['12',''],['13','']], str)
+        self.assertRaises(ValueError, np.fromiter, [['12',''],['13','']], str)
 
     def test_dot_negative_stride(self, level=rlevel):
         """Ticket #588"""
@@ -607,7 +607,7 @@
             x = np.ones([484,286])
             y = np.zeros([484,286])
             x |= y
-        self.failUnlessRaises(TypeError,rs)
+        self.assertRaises(TypeError,rs)
 
     def test_unicode_scalar(self, level=rlevel):
         """Ticket #600"""
@@ -629,7 +629,7 @@
         s = np.ones(10,dtype=float)
         x = np.array((15,),dtype=float)
         def ia(x,s): x[(s>0)]=1.0
-        self.failUnlessRaises(ValueError,ia,x,s)
+        self.assertRaises(ValueError,ia,x,s)
 
     def test_mem_scalar_indexing(self, level=rlevel):
         """Ticket #603"""
@@ -820,7 +820,7 @@
 
     def test_mem_fromiter_invalid_dtype_string(self, level=rlevel):
         x = [1,2,3]
-        self.failUnlessRaises(ValueError,
+        self.assertRaises(ValueError,
                               np.fromiter, [xi for xi in x], dtype='S')
 
     def test_reduce_big_object_array(self, level=rlevel):
@@ -1033,7 +1033,7 @@
     def test_for_zero_length_in_choose(self, level=rlevel):
         "Ticket #882"
         a = np.array(1)
-        self.failUnlessRaises(ValueError, lambda x: x.choose([]), a)
+        self.assertRaises(ValueError, lambda x: x.choose([]), a)
 
     def test_array_ndmin_overflow(self):
         "Ticket #947."
@@ -1095,7 +1095,7 @@
         good = 'Maximum allowed size exceeded'
         try:
             a = np.arange(sz)
-            self.failUnless(np.size == sz)
+            self.assertTrue(np.size == sz)
         except ValueError, e:
             if not str(e) == good:
                 self.fail("Got msg '%s', expected '%s'" % (e, good))
@@ -1161,7 +1161,7 @@
         a = np.array([[u'abc', u'\u03a3'], [u'asdf', u'erw']], dtype='U')
         def fail():
             b = np.array(a, 'S4')
-        self.failUnlessRaises(UnicodeEncodeError, fail)
+        self.assertRaises(UnicodeEncodeError, fail)
 
     def test_mixed_string_unicode_array_creation(self):
         a = np.array(['1234', u'123'])
@@ -1239,7 +1239,7 @@
         """Ticket #1254"""
         def func():
             x = np.dtype([(('a', 'a'), 'i'), ('b', 'i')])
-        self.failUnlessRaises(ValueError, func)
+        self.assertRaises(ValueError, func)
 
     def test_signed_integer_division_overflow(self):
         """Ticket #1317."""

Modified: trunk/numpy/core/tests/test_umath.py
===================================================================
--- trunk/numpy/core/tests/test_umath.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/core/tests/test_umath.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -420,11 +420,11 @@
         x = ncu.minimum(a, a)
         assert_equal(x.arr, np.zeros(1))
         func, args, i = x.context
-        self.failUnless(func is ncu.minimum)
-        self.failUnlessEqual(len(args), 2)
+        self.assertTrue(func is ncu.minimum)
+        self.assertEqual(len(args), 2)
         assert_equal(args[0], a)
         assert_equal(args[1], a)
-        self.failUnlessEqual(i, 0)
+        self.assertEqual(i, 0)
 
     def test_wrap_with_iterable(self):
         # test fix for bug #1026:
@@ -436,7 +436,7 @@
                 return arr.view(type(self))
         a = with_wrap()
         x = ncu.multiply(a, (1, 2, 3))
-        self.failUnless(isinstance(x, with_wrap))
+        self.assertTrue(isinstance(x, with_wrap))
         assert_array_equal(x, np.array((1, 2, 3)))
 
     def test_priority_with_scalar(self):
@@ -447,7 +447,7 @@
                 return np.asarray(1.0, 'float64').view(cls).copy()
         a = A()
         x = np.float64(1)*a
-        self.failUnless(isinstance(x, A))
+        self.assertTrue(isinstance(x, A))
         assert_array_equal(x, np.array(1))
 
     def test_old_wrap(self):
@@ -480,25 +480,25 @@
         b = B()
         c = C()
         f = ncu.minimum
-        self.failUnless(type(f(x,x)) is np.ndarray)
-        self.failUnless(type(f(x,a)) is A)
-        self.failUnless(type(f(x,b)) is B)
-        self.failUnless(type(f(x,c)) is C)
-        self.failUnless(type(f(a,x)) is A)
-        self.failUnless(type(f(b,x)) is B)
-        self.failUnless(type(f(c,x)) is C)
+        self.assertTrue(type(f(x,x)) is np.ndarray)
+        self.assertTrue(type(f(x,a)) is A)
+        self.assertTrue(type(f(x,b)) is B)
+        self.assertTrue(type(f(x,c)) is C)
+        self.assertTrue(type(f(a,x)) is A)
+        self.assertTrue(type(f(b,x)) is B)
+        self.assertTrue(type(f(c,x)) is C)
 
-        self.failUnless(type(f(a,a)) is A)
-        self.failUnless(type(f(a,b)) is B)
-        self.failUnless(type(f(b,a)) is B)
-        self.failUnless(type(f(b,b)) is B)
-        self.failUnless(type(f(b,c)) is C)
-        self.failUnless(type(f(c,b)) is C)
-        self.failUnless(type(f(c,c)) is C)
+        self.assertTrue(type(f(a,a)) is A)
+        self.assertTrue(type(f(a,b)) is B)
+        self.assertTrue(type(f(b,a)) is B)
+        self.assertTrue(type(f(b,b)) is B)
+        self.assertTrue(type(f(b,c)) is C)
+        self.assertTrue(type(f(c,b)) is C)
+        self.assertTrue(type(f(c,c)) is C)
 
-        self.failUnless(type(ncu.exp(a) is A))
-        self.failUnless(type(ncu.exp(b) is B))
-        self.failUnless(type(ncu.exp(c) is C))
+        self.assertTrue(type(ncu.exp(a) is A))
+        self.assertTrue(type(ncu.exp(b) is B))
+        self.assertTrue(type(ncu.exp(c) is C))
 
     def test_failing_wrap(self):
         class A(object):
@@ -507,7 +507,7 @@
             def __array_wrap__(self, arr, context):
                 raise RuntimeError
         a = A()
-        self.failUnlessRaises(RuntimeError, ncu.maximum, a, a)
+        self.assertRaises(RuntimeError, ncu.maximum, a, a)
 
     def test_default_prepare(self):
         class with_wrap(object):
@@ -539,7 +539,7 @@
             def __array_prepare__(self, arr, context=None):
                 raise RuntimeError
         a = A()
-        self.failUnlessRaises(RuntimeError, ncu.maximum, a, a)
+        self.assertRaises(RuntimeError, ncu.maximum, a, a)
 
     def test_array_with_context(self):
         class A(object):
@@ -557,10 +557,10 @@
                 return np.zeros(1)
         a = A()
         ncu.maximum(np.zeros(1), a)
-        self.failUnless(a.func is ncu.maximum)
+        self.assertTrue(a.func is ncu.maximum)
         assert_equal(a.args[0], 0)
-        self.failUnless(a.args[1] is a)
-        self.failUnless(a.i == 1)
+        self.assertTrue(a.args[1] is a)
+        self.assertTrue(a.i == 1)
         assert_equal(ncu.maximum(a, B()), 0)
         assert_equal(ncu.maximum(a, C()), 0)
 
@@ -771,8 +771,8 @@
         add = ncu.add
         assert_equal(add.__name__, 'add')
         assert add.__doc__.startswith('add(x1, x2[, out])\n\n')
-        self.failUnless(add.ntypes >= 18) # don't fail if types added
-        self.failUnless('ii->i' in add.types)
+        self.assertTrue(add.ntypes >= 18) # don't fail if types added
+        self.assertTrue('ii->i' in add.types)
         assert_equal(add.nin, 2)
         assert_equal(add.nout, 1)
         assert_equal(add.identity, 0)

Modified: trunk/numpy/distutils/tests/test_npy_pkg_config.py
===================================================================
--- trunk/numpy/distutils/tests/test_npy_pkg_config.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/distutils/tests/test_npy_pkg_config.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -46,10 +46,10 @@
                 os.close(fd)
 
             out = read_config(pkg)
-            self.failUnless(out.cflags() == simple_d['cflags'])
-            self.failUnless(out.libs() == simple_d['libflags'])
-            self.failUnless(out.name == simple_d['name'])
-            self.failUnless(out.version == simple_d['version'])
+            self.assertTrue(out.cflags() == simple_d['cflags'])
+            self.assertTrue(out.libs() == simple_d['libflags'])
+            self.assertTrue(out.name == simple_d['name'])
+            self.assertTrue(out.version == simple_d['version'])
         finally:
             os.remove(filename)
 
@@ -63,34 +63,34 @@
                 os.close(fd)
 
             out = read_config(pkg)
-            self.failUnless(out.cflags() == simple_variable_d['cflags'])
-            self.failUnless(out.libs() == simple_variable_d['libflags'])
-            self.failUnless(out.name == simple_variable_d['name'])
-            self.failUnless(out.version == simple_variable_d['version'])
+            self.assertTrue(out.cflags() == simple_variable_d['cflags'])
+            self.assertTrue(out.libs() == simple_variable_d['libflags'])
+            self.assertTrue(out.name == simple_variable_d['name'])
+            self.assertTrue(out.version == simple_variable_d['version'])
 
             out.vars['prefix'] = '/Users/david'
-            self.failUnless(out.cflags() == '-I/Users/david/include')
+            self.assertTrue(out.cflags() == '-I/Users/david/include')
         finally:
             os.remove(filename)
 
 class TestParseFlags(TestCase):
     def test_simple_cflags(self):
         d = parse_flags("-I/usr/include")
-        self.failUnless(d['include_dirs'] == ['/usr/include'])
+        self.assertTrue(d['include_dirs'] == ['/usr/include'])
 
         d = parse_flags("-I/usr/include -DFOO")
-        self.failUnless(d['include_dirs'] == ['/usr/include'])
-        self.failUnless(d['macros'] == ['FOO'])
+        self.assertTrue(d['include_dirs'] == ['/usr/include'])
+        self.assertTrue(d['macros'] == ['FOO'])
 
         d = parse_flags("-I /usr/include -DFOO")
-        self.failUnless(d['include_dirs'] == ['/usr/include'])
-        self.failUnless(d['macros'] == ['FOO'])
+        self.assertTrue(d['include_dirs'] == ['/usr/include'])
+        self.assertTrue(d['macros'] == ['FOO'])
 
     def test_simple_lflags(self):
         d = parse_flags("-L/usr/lib -lfoo -L/usr/lib -lbar")
-        self.failUnless(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
-        self.failUnless(d['libraries'] == ['foo', 'bar'])
+        self.assertTrue(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+        self.assertTrue(d['libraries'] == ['foo', 'bar'])
 
         d = parse_flags("-L /usr/lib -lfoo -L/usr/lib -lbar")
-        self.failUnless(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
-        self.failUnless(d['libraries'] == ['foo', 'bar'])
+        self.assertTrue(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+        self.assertTrue(d['libraries'] == ['foo', 'bar'])

Modified: trunk/numpy/fft/tests/test_fftpack.py
===================================================================
--- trunk/numpy/fft/tests/test_fftpack.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/fft/tests/test_fftpack.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -9,7 +9,7 @@
 
 class TestFFTShift(TestCase):
     def test_fft_n(self):
-        self.failUnlessRaises(ValueError,np.fft.fft,[1,2,3],0)
+        self.assertRaises(ValueError,np.fft.fft,[1,2,3],0)
 
 
 class TestFFT1D(TestCase):

Modified: trunk/numpy/lib/tests/test_function_base.py
===================================================================
--- trunk/numpy/lib/tests/test_function_base.py	2010-02-20 22:31:25 UTC (rev 8195)
+++ trunk/numpy/lib/tests/test_function_base.py	2010-02-21 01:55:27 UTC (rev 8196)
@@ -198,9 +198,9 @@
             a = array(ba,ctype)
             a2 = array(ba2,ctype)
             if ctype in ['1', 'b']:
-                self.failUnlessRaises(ArithmeticError, prod, a)
-                self.failUnlessRaises(ArithmeticError, prod, a2, 1)
-                self.failUnlessRaises(ArithmeticError, prod, a)
+                self.assertRaises(ArithmeticError, prod, a)
+                self.assertRaises(ArithmeticError, prod, a2, 1)
+                self.assertRaises(ArithmeticError, prod, a)
             else:
                 assert_equal(prod(a,axis=0),26400)
                 assert_array_equal(prod(a2,axis=0),
@@ -216,9 +216,9 @@
             a = array(ba,ctype)
             a2 = array(ba2,ctype)
             if ctype in ['1', 'b']:
-                self.failUnlessRaises(ArithmeticError, cumprod, a)
-                self.failUnlessRaises(ArithmeticError, cumprod, a2, 1)
-                self.failUnlessRaises(ArithmeticError, cumprod, a)
+                self.assertRaises(ArithmeticError, cumprod, a)
+                self.assertRaises(ArithmeticError, cumprod, a2, 1)
+                self.assertRaises(ArithmeticError, cumprod, a)
             else:
                 assert_array_equal(cumprod(a,axis=-1),
                                    array([1, 2, 20, 220,



More information about the Numpy-svn mailing list