[Numpy-svn] r5335 - trunk/numpy/core/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Jul 2 22:49:07 EDT 2008


Author: alan.mcintyre
Date: 2008-07-02 21:49:02 -0500 (Wed, 02 Jul 2008)
New Revision: 5335

Modified:
   trunk/numpy/core/tests/test_defmatrix.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_scalarmath.py
   trunk/numpy/core/tests/test_umath.py
   trunk/numpy/core/tests/test_unicode.py
Log:
Remove uses of set_package_path, set_local_path, restore_path.
Clean up and (somewhat) standardize test module imports.
In test_scalararray.py and test_defmatrix.py, update tests that are commented out so that 
they will be picked up in case they are ever uncommented.


Modified: trunk/numpy/core/tests/test_defmatrix.py
===================================================================
--- trunk/numpy/core/tests/test_defmatrix.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_defmatrix.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,9 +1,7 @@
 import sys
 from numpy.testing import *
-set_package_path()
 from numpy.core import *
 import numpy as np
-restore_path()
 
 class TestCtor(TestCase):
     def test_basic(self):
@@ -216,11 +214,11 @@
         assert isinstance(x, matrix)
         assert_equal(x, matrix([[4,  3], [1,  2]]))
 
-##     def check_vector_element(self):
-##         x = matrix([[1,2,3],[4,5,6]])
-##         assert_equal(x[0][0],1)
-##         assert_equal(x[0].shape,(1,3))
-##         assert_equal(x[:,0].shape,(2,1))
+#     def test_vector_element(self):
+#         x = matrix([[1,2,3],[4,5,6]])
+#         assert_equal(x[0][0],1)
+#         assert_equal(x[0].shape,(1,3))
+#         assert_equal(x[:,0].shape,(2,1))
 
     def test_matrix_element(self):
         x = matrix([[1,2,3],[4,5,6]])

Modified: trunk/numpy/core/tests/test_numeric.py
===================================================================
--- trunk/numpy/core/tests/test_numeric.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_numeric.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -291,17 +291,16 @@
         return (randn(n, m)).astype(float32)
 
     def _neg_byteorder(self, a):
-        import sys
-        a   = asarray(a)
+        a = asarray(a)
         if sys.byteorder == 'little':
-            a   = a.astype(a.dtype.newbyteorder('>'))
+            a = a.astype(a.dtype.newbyteorder('>'))
         else:
-            a   = a.astype(a.dtype.newbyteorder('<'))
+            a = a.astype(a.dtype.newbyteorder('<'))
         return a
 
     def _generate_non_native_data(self, n, m):
-        data    = randn(n, m)
-        data    = self._neg_byteorder(data)
+        data = randn(n, m)
+        data = self._neg_byteorder(data)
         assert not data.dtype.isnative
         return data
 

Modified: trunk/numpy/core/tests/test_numerictypes.py
===================================================================
--- trunk/numpy/core/tests/test_numerictypes.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_numerictypes.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,7 +1,6 @@
 import sys
 from numpy.testing import *
-import numpy
-from numpy import zeros, ones, array
+import numpy as np
 
 # This is the structure of the table used for plain objects:
 #
@@ -103,33 +102,33 @@
 
     def test_zeros0D(self):
         """Check creation of 0-dimensional objects"""
-        h = zeros((), dtype=self._descr)
+        h = np.zeros((), dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         self.assert_(h.dtype.fields['x'][0].name[:4] == 'void')
         self.assert_(h.dtype.fields['x'][0].char == 'V')
-        self.assert_(h.dtype.fields['x'][0].type == numpy.void)
+        self.assert_(h.dtype.fields['x'][0].type == np.void)
         # A small check that data is ok
-        assert_equal(h['z'], zeros((), dtype='u1'))
+        assert_equal(h['z'], np.zeros((), dtype='u1'))
 
     def test_zerosSD(self):
         """Check creation of single-dimensional objects"""
-        h = zeros((2,), dtype=self._descr)
+        h = np.zeros((2,), dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         self.assert_(h.dtype['y'].name[:4] == 'void')
         self.assert_(h.dtype['y'].char == 'V')
-        self.assert_(h.dtype['y'].type == numpy.void)
+        self.assert_(h.dtype['y'].type == np.void)
         # A small check that data is ok
-        assert_equal(h['z'], zeros((2,), dtype='u1'))
+        assert_equal(h['z'], np.zeros((2,), dtype='u1'))
 
     def test_zerosMD(self):
         """Check creation of multi-dimensional objects"""
-        h = zeros((2,3), dtype=self._descr)
+        h = np.zeros((2,3), dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         self.assert_(h.dtype['z'].name == 'uint8')
         self.assert_(h.dtype['z'].char == 'B')
-        self.assert_(h.dtype['z'].type == numpy.uint8)
+        self.assert_(h.dtype['z'].type == np.uint8)
         # A small check that data is ok
-        assert_equal(h['z'], zeros((2,3), dtype='u1'))
+        assert_equal(h['z'], np.zeros((2,3), dtype='u1'))
 
 
 class test_create_zeros_plain(create_zeros, TestCase):
@@ -146,7 +145,7 @@
 
     def test_tuple(self):
         """Check creation from tuples"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         if self.multiple_rows:
             self.assert_(h.shape == (2,))
@@ -155,7 +154,7 @@
 
     def test_list_of_tuple(self):
         """Check creation from list of tuples"""
-        h = array([self._buffer], dtype=self._descr)
+        h = np.array([self._buffer], dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         if self.multiple_rows:
             self.assert_(h.shape == (1,2))
@@ -164,7 +163,7 @@
 
     def test_list_of_list_of_tuple(self):
         """Check creation from list of list of tuples"""
-        h = array([[self._buffer]], dtype=self._descr)
+        h = np.array([[self._buffer]], dtype=self._descr)
         self.assert_(normalize_descr(self._descr) == h.dtype.descr)
         if self.multiple_rows:
             self.assert_(h.shape == (1,1,2))
@@ -205,19 +204,19 @@
     """Check the reading of values in heterogeneous arrays (plain)"""
 
     def test_access_fields(self):
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         if not self.multiple_rows:
             self.assert_(h.shape == ())
-            assert_equal(h['x'], array(self._buffer[0], dtype='i4'))
-            assert_equal(h['y'], array(self._buffer[1], dtype='f8'))
-            assert_equal(h['z'], array(self._buffer[2], dtype='u1'))
+            assert_equal(h['x'], np.array(self._buffer[0], dtype='i4'))
+            assert_equal(h['y'], np.array(self._buffer[1], dtype='f8'))
+            assert_equal(h['z'], np.array(self._buffer[2], dtype='u1'))
         else:
             self.assert_(len(h) == 2)
-            assert_equal(h['x'], array([self._buffer[0][0],
+            assert_equal(h['x'], np.array([self._buffer[0][0],
                                              self._buffer[1][0]], dtype='i4'))
-            assert_equal(h['y'], array([self._buffer[0][1],
+            assert_equal(h['y'], np.array([self._buffer[0][1],
                                              self._buffer[1][1]], dtype='f8'))
-            assert_equal(h['z'], array([self._buffer[0][2],
+            assert_equal(h['z'], np.array([self._buffer[0][2],
                                              self._buffer[1][2]], dtype='u1'))
 
 
@@ -239,73 +238,73 @@
 
     def test_access_top_fields(self):
         """Check reading the top fields of a nested array"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         if not self.multiple_rows:
             self.assert_(h.shape == ())
-            assert_equal(h['x'], array(self._buffer[0], dtype='i4'))
-            assert_equal(h['y'], array(self._buffer[4], dtype='f8'))
-            assert_equal(h['z'], array(self._buffer[5], dtype='u1'))
+            assert_equal(h['x'], np.array(self._buffer[0], dtype='i4'))
+            assert_equal(h['y'], np.array(self._buffer[4], dtype='f8'))
+            assert_equal(h['z'], np.array(self._buffer[5], dtype='u1'))
         else:
             self.assert_(len(h) == 2)
-            assert_equal(h['x'], array([self._buffer[0][0],
-                                             self._buffer[1][0]], dtype='i4'))
-            assert_equal(h['y'], array([self._buffer[0][4],
-                                             self._buffer[1][4]], dtype='f8'))
-            assert_equal(h['z'], array([self._buffer[0][5],
-                                             self._buffer[1][5]], dtype='u1'))
+            assert_equal(h['x'], np.array([self._buffer[0][0],
+                                           self._buffer[1][0]], dtype='i4'))
+            assert_equal(h['y'], np.array([self._buffer[0][4],
+                                           self._buffer[1][4]], dtype='f8'))
+            assert_equal(h['z'], np.array([self._buffer[0][5],
+                                           self._buffer[1][5]], dtype='u1'))
+            
 
-
     def test_nested1_acessors(self):
         """Check reading the nested fields of a nested array (1st level)"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         if not self.multiple_rows:
             assert_equal(h['Info']['value'],
-                         array(self._buffer[1][0], dtype='c16'))
+                         np.array(self._buffer[1][0], dtype='c16'))
             assert_equal(h['Info']['y2'],
-                         array(self._buffer[1][1], dtype='f8'))
+                         np.array(self._buffer[1][1], dtype='f8'))
             assert_equal(h['info']['Name'],
-                         array(self._buffer[3][0], dtype='U2'))
+                         np.array(self._buffer[3][0], dtype='U2'))
             assert_equal(h['info']['Value'],
-                         array(self._buffer[3][1], dtype='c16'))
+                         np.array(self._buffer[3][1], dtype='c16'))
         else:
             assert_equal(h['Info']['value'],
-                         array([self._buffer[0][1][0],
+                         np.array([self._buffer[0][1][0],
                                 self._buffer[1][1][0]],
                                 dtype='c16'))
             assert_equal(h['Info']['y2'],
-                         array([self._buffer[0][1][1],
+                         np.array([self._buffer[0][1][1],
                                 self._buffer[1][1][1]],
                                 dtype='f8'))
             assert_equal(h['info']['Name'],
-                         array([self._buffer[0][3][0],
+                         np.array([self._buffer[0][3][0],
                                 self._buffer[1][3][0]],
                                dtype='U2'))
             assert_equal(h['info']['Value'],
-                         array([self._buffer[0][3][1],
+                         np.array([self._buffer[0][3][1],
                                 self._buffer[1][3][1]],
                                dtype='c16'))
 
     def test_nested2_acessors(self):
         """Check reading the nested fields of a nested array (2nd level)"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         if not self.multiple_rows:
             assert_equal(h['Info']['Info2']['value'],
-                         array(self._buffer[1][2][1], dtype='c16'))
+                         np.array(self._buffer[1][2][1], dtype='c16'))
             assert_equal(h['Info']['Info2']['z3'],
-                         array(self._buffer[1][2][3], dtype='u4'))
+                         np.array(self._buffer[1][2][3], dtype='u4'))
         else:
             assert_equal(h['Info']['Info2']['value'],
-                         array([self._buffer[0][1][2][1],
+                         np.array([self._buffer[0][1][2][1],
                                 self._buffer[1][1][2][1]],
                                dtype='c16'))
             assert_equal(h['Info']['Info2']['z3'],
-                         array([self._buffer[0][1][2][3],
+                         np.array([self._buffer[0][1][2][3],
                                 self._buffer[1][1][2][3]],
                                dtype='u4'))
 
     def test_nested1_descriptor(self):
         """Check access nested descriptors of a nested array (1st level)"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         self.assert_(h.dtype['Info']['value'].name == 'complex128')
         self.assert_(h.dtype['Info']['y2'].name == 'float64')
         self.assert_(h.dtype['info']['Name'].name == 'unicode256')
@@ -313,7 +312,7 @@
 
     def test_nested2_descriptor(self):
         """Check access nested descriptors of a nested array (2nd level)"""
-        h = array(self._buffer, dtype=self._descr)
+        h = np.array(self._buffer, dtype=self._descr)
         self.assert_(h.dtype['Info']['Info2']['value'].name == 'void256')
         self.assert_(h.dtype['Info']['Info2']['z3'].name == 'void64')
 
@@ -332,26 +331,26 @@
 
 class TestEmptyField(TestCase):
     def test_assign(self):
-        a = numpy.arange(10, dtype=numpy.float32)
+        a = np.arange(10, dtype=np.float32)
         a.dtype = [("int",   "<0i4"),("float", "<2f4")]
         assert(a['int'].shape == (5,0))
         assert(a['float'].shape == (5,2))
 
 class TestCommonType(TestCase):
     def test_scalar_loses1(self):
-        res = numpy.find_common_type(['f4','f4','i4'],['f8'])
+        res = np.find_common_type(['f4','f4','i4'],['f8'])
         assert(res == 'f4')
     def test_scalar_loses2(self):
-        res = numpy.find_common_type(['f4','f4'],['i8'])
+        res = np.find_common_type(['f4','f4'],['i8'])
         assert(res == 'f4')
     def test_scalar_wins(self):
-        res = numpy.find_common_type(['f4','f4','i4'],['c8'])
+        res = np.find_common_type(['f4','f4','i4'],['c8'])
         assert(res == 'c8')
     def test_scalar_wins2(self):
-        res = numpy.find_common_type(['u4','i4','i4'],['f4'])
+        res = np.find_common_type(['u4','i4','i4'],['f4'])
         assert(res == 'f8')
     def test_scalar_wins3(self): # doesn't go up to 'f16' on purpose
-        res = numpy.find_common_type(['u8','i8','i8'],['f8'])
+        res = np.find_common_type(['u8','i8','i8'],['f8'])
         assert(res == 'f8')
 
 

Modified: trunk/numpy/core/tests/test_records.py
===================================================================
--- trunk/numpy/core/tests/test_records.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_records.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,8 +1,6 @@
+from os import path
 import numpy as np
 from numpy.testing import *
-from os import path
-set_package_path()
-restore_path()
 
 class TestFromrecords(TestCase):
     def test_fromrecords(self):

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_regression.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -3,9 +3,7 @@
 import sys
 from os import path
 from numpy.testing import *
-set_local_path()
 import numpy as np
-restore_path()
 
 rlevel = 1
 

Modified: trunk/numpy/core/tests/test_scalarmath.py
===================================================================
--- trunk/numpy/core/tests/test_scalarmath.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_scalarmath.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,6 +1,5 @@
 from numpy.testing import *
 import numpy.core.umath as ncu
-from numpy import array
 import numpy as np
 
 types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc,
@@ -20,10 +19,10 @@
         # list of types
         for k, atype in enumerate(types):
             vala = atype(3)
-            val1 = array([3],dtype=atype)
+            val1 = np.array([3],dtype=atype)
             for l, btype in enumerate(types):
                 valb = btype(1)
-                val2 = array([1],dtype=btype)
+                val2 = np.array([1],dtype=btype)
                 val = vala+valb
                 valo = val1 + val2
                 assert val.dtype.num == valo.dtype.num and \
@@ -32,7 +31,7 @@
 
     def test_type_create(self, level=1):
         for k, atype in enumerate(types):
-            a = array([1,2,3],atype)
+            a = np.array([1,2,3],atype)
             b = atype([1,2,3])
             assert_equal(a,b)
 
@@ -67,8 +66,8 @@
         assert_equal(map(int,a), li[:3])
 
 
-#class TestRepr(NumpyTestCase):
-#    def check_repr(self):
+#class TestRepr(TestCase):
+#    def test_repr(self):
 #        for t in types:
 #            val = t(1197346475.0137341)
 #            val_repr = repr(val)
@@ -89,7 +88,7 @@
             # could add some more types to the list below
             for which in ['small denorm','small norm']: 
                 # Values from http://en.wikipedia.org/wiki/IEEE_754
-                constr = array([0x00]*storage_bytes,dtype=np.uint8)
+                constr = np.array([0x00]*storage_bytes,dtype=np.uint8)
                 if which == 'small denorm':
                     byte = last_fraction_bit_idx // 8
                     bytebit = 7-(last_fraction_bit_idx % 8)

Modified: trunk/numpy/core/tests/test_umath.py
===================================================================
--- trunk/numpy/core/tests/test_umath.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_umath.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,22 +1,18 @@
 from numpy.testing import *
-set_package_path()
-from numpy.core.umath import minimum, maximum, exp
 import numpy.core.umath as ncu
-from numpy import zeros, ndarray, array, choose, pi
 import numpy as np
-restore_path()
 
 class TestDivision(TestCase):
     def test_division_int(self):
         # int division should return the floor of the result, a la Python
-        x = array([5, 10, 90, 100, -5, -10, -90, -100, -120])
+        x = np.array([5, 10, 90, 100, -5, -10, -90, -100, -120])
         assert_equal(x / 100, [0, 0, 0, 1, -1, -1, -1, -1, -2])
         assert_equal(x // 100, [0, 0, 0, 1, -1, -1, -1, -1, -2])
         assert_equal(x % 100, [5, 10, 90, 0, 95, 90, 10, 0, 80])
 
 class TestPower(TestCase):
     def test_power_float(self):
-        x = array([1., 2., 3.])
+        x = np.array([1., 2., 3.])
         assert_equal(x**0, [1., 1., 1.])
         assert_equal(x**1, x)
         assert_equal(x**2, [1., 4., 9.])
@@ -27,7 +23,7 @@
         assert_almost_equal(x**(0.5), [1., ncu.sqrt(2), ncu.sqrt(3)])
 
     def test_power_complex(self):
-        x = array([1+2j, 2+3j, 3+4j])
+        x = np.array([1+2j, 2+3j, 3+4j])
         assert_equal(x**0, [1., 1., 1.])
         assert_equal(x**1, x)
         assert_equal(x**2, [-3+4j, -5+12j, -7+24j])
@@ -52,12 +48,12 @@
 
 class TestMaximum(TestCase):
     def test_reduce_complex(self):
-        assert_equal(maximum.reduce([1,2j]),1)
-        assert_equal(maximum.reduce([1+3j,2j]),1+3j)
+        assert_equal(ncu.maximum.reduce([1,2j]),1)
+        assert_equal(ncu.maximum.reduce([1+3j,2j]),1+3j)
 
 class TestMinimum(TestCase):
     def test_reduce_complex(self):
-        assert_equal(minimum.reduce([1,2j]),2j)
+        assert_equal(ncu.minimum.reduce([1,2j]),2j)
 
 class TestFloatingPoint(TestCase):
     def test_floating_point(self):
@@ -65,29 +61,29 @@
 
 class TestDegrees(TestCase):
     def test_degrees(self):
-        assert_almost_equal(ncu.degrees(pi), 180.0)
-        assert_almost_equal(ncu.degrees(-0.5*pi), -90.0)
+        assert_almost_equal(ncu.degrees(np.pi), 180.0)
+        assert_almost_equal(ncu.degrees(-0.5*np.pi), -90.0)
 
 class TestRadians(TestCase):
     def test_radians(self):
-        assert_almost_equal(ncu.radians(180.0), pi)
-        assert_almost_equal(ncu.radians(-90.0), -0.5*pi)
+        assert_almost_equal(ncu.radians(180.0), np.pi)
+        assert_almost_equal(ncu.radians(-90.0), -0.5*np.pi)
 
 class TestSpecialMethods(TestCase):
     def test_wrap(self):
         class with_wrap(object):
             def __array__(self):
-                return zeros(1)
+                return np.zeros(1)
             def __array_wrap__(self, arr, context):
                 r = with_wrap()
                 r.arr = arr
                 r.context = context
                 return r
         a = with_wrap()
-        x = minimum(a, a)
-        assert_equal(x.arr, zeros(1))
+        x = ncu.minimum(a, a)
+        assert_equal(x.arr, np.zeros(1))
         func, args, i = x.context
-        self.failUnless(func is minimum)
+        self.failUnless(func is ncu.minimum)
         self.failUnlessEqual(len(args), 2)
         assert_equal(args[0], a)
         assert_equal(args[1], a)
@@ -96,19 +92,19 @@
     def test_old_wrap(self):
         class with_wrap(object):
             def __array__(self):
-                return zeros(1)
+                return np.zeros(1)
             def __array_wrap__(self, arr):
                 r = with_wrap()
                 r.arr = arr
                 return r
         a = with_wrap()
-        x = minimum(a, a)
-        assert_equal(x.arr, zeros(1))
+        x = ncu.minimum(a, a)
+        assert_equal(x.arr, np.zeros(1))
 
     def test_priority(self):
         class A(object):
             def __array__(self):
-                return zeros(1)
+                return np.zeros(1)
             def __array_wrap__(self, arr, context):
                 r = type(self)()
                 r.arr = arr
@@ -118,12 +114,12 @@
             __array_priority__ = 20.
         class C(A):
             __array_priority__ = 40.
-        x = zeros(1)
+        x = np.zeros(1)
         a = A()
         b = B()
         c = C()
-        f = minimum
-        self.failUnless(type(f(x,x)) is ndarray)
+        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)
@@ -139,18 +135,18 @@
         self.failUnless(type(f(c,b)) is C)
         self.failUnless(type(f(c,c)) is C)
 
-        self.failUnless(type(exp(a) is A))
-        self.failUnless(type(exp(b) is B))
-        self.failUnless(type(exp(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))
 
     def test_failing_wrap(self):
         class A(object):
             def __array__(self):
-                return zeros(1)
+                return np.zeros(1)
             def __array_wrap__(self, arr, context):
                 raise RuntimeError
         a = A()
-        self.failUnlessRaises(RuntimeError, maximum, a, a)
+        self.failUnlessRaises(RuntimeError, ncu.maximum, a, a)
 
     def test_array_with_context(self):
         class A(object):
@@ -159,28 +155,28 @@
                 self.func = func
                 self.args = args
                 self.i = i
-                return zeros(1)
+                return np.zeros(1)
         class B(object):
             def __array__(self, dtype=None):
-                return zeros(1, dtype)
+                return np.zeros(1, dtype)
         class C(object):
             def __array__(self):
-                return zeros(1)
+                return np.zeros(1)
         a = A()
-        maximum(zeros(1), a)
-        self.failUnless(a.func is maximum)
+        ncu.maximum(np.zeros(1), a)
+        self.failUnless(a.func is ncu.maximum)
         assert_equal(a.args[0], 0)
         self.failUnless(a.args[1] is a)
         self.failUnless(a.i == 1)
-        assert_equal(maximum(a, B()), 0)
-        assert_equal(maximum(a, C()), 0)
+        assert_equal(ncu.maximum(a, B()), 0)
+        assert_equal(ncu.maximum(a, C()), 0)
 
 
 class TestChoose(TestCase):
     def test_mixed(self):
-        c = array([True,True])
-        a = array([True,True])
-        assert_equal(choose(c, (a, 1)), array([1,1]))
+        c = np.array([True,True])
+        a = np.array([True,True])
+        assert_equal(np.choose(c, (a, 1)), np.array([1,1]))
 
 
 class TestComplexFunctions(TestCase):

Modified: trunk/numpy/core/tests/test_unicode.py
===================================================================
--- trunk/numpy/core/tests/test_unicode.py	2008-07-03 02:34:59 UTC (rev 5334)
+++ trunk/numpy/core/tests/test_unicode.py	2008-07-03 02:49:02 UTC (rev 5335)
@@ -1,4 +1,3 @@
-import sys
 from numpy.testing import *
 from numpy.core import *
 




More information about the Numpy-svn mailing list