summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_utils.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-14 23:15:21 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-14 23:15:21 +0000
commitf77587b2cd9091a99a31bb0d5f99c57cc077aa8e (patch)
tree8894af7b880beece61903e47dd84c7205e3ee8d3 /numpy/lib/tests/test_utils.py
parent06acb9555bf64997423b124620fb469cab24cb2b (diff)
downloadnumpy-f77587b2cd9091a99a31bb0d5f99c57cc077aa8e.tar.gz
Fix Python 2.5 compatibility to work with new b3 release
Diffstat (limited to 'numpy/lib/tests/test_utils.py')
-rw-r--r--numpy/lib/tests/test_utils.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py
deleted file mode 100644
index fc98a92b6..000000000
--- a/numpy/lib/tests/test_utils.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from numpy.testing import *
-set_package_path()
-import numpy as N
-restore_path()
-
-class test_ndpointer(NumpyTestCase):
- def check_dtype(self):
- dt = N.intc
- p = N.ndpointer(dtype=dt)
- self.assert_(p.from_param(N.array([1], dt)))
- dt = '<i4'
- p = N.ndpointer(dtype=dt)
- self.assert_(p.from_param(N.array([1], dt)))
- dt = N.dtype('>i4')
- p = N.ndpointer(dtype=dt)
- p.from_param(N.array([1], dt))
- self.assertRaises(TypeError, p.from_param,
- N.array([1], dt.newbyteorder('swap')))
- dtnames = ['x', 'y']
- dtformats = [N.intc, N.float64]
- dtdescr = {'names' : dtnames, 'formats' : dtformats}
- dt = N.dtype(dtdescr)
- p = N.ndpointer(dtype=dt)
- self.assert_(p.from_param(N.zeros((10,), dt)))
- samedt = N.dtype(dtdescr)
- p = N.ndpointer(dtype=samedt)
- self.assert_(p.from_param(N.zeros((10,), dt)))
- dt2 = N.dtype(dtdescr, align=True)
- if dt.itemsize != dt2.itemsize:
- self.assertRaises(TypeError, p.from_param, N.zeros((10,), dt2))
- else:
- self.assert_(p.from_param(N.zeros((10,), dt2)))
-
- def check_ndim(self):
- p = N.ndpointer(ndim=0)
- self.assert_(p.from_param(N.array(1)))
- self.assertRaises(TypeError, p.from_param, N.array([1]))
- p = N.ndpointer(ndim=1)
- self.assertRaises(TypeError, p.from_param, N.array(1))
- self.assert_(p.from_param(N.array([1])))
- p = N.ndpointer(ndim=2)
- self.assert_(p.from_param(N.array([[1]])))
-
- def check_shape(self):
- p = N.ndpointer(shape=(1,2))
- self.assert_(p.from_param(N.array([[1,2]])))
- self.assertRaises(TypeError, p.from_param, N.array([[1],[2]]))
- p = N.ndpointer(shape=())
- self.assert_(p.from_param(N.array(1)))
-
- def check_flags(self):
- x = N.array([[1,2,3]], order='F')
- p = N.ndpointer(flags='FORTRAN')
- self.assert_(p.from_param(x))
- p = N.ndpointer(flags='CONTIGUOUS')
- self.assertRaises(TypeError, p.from_param, x)
- p = N.ndpointer(flags=x.flags.num)
- self.assert_(p.from_param(x))
- self.assertRaises(TypeError, p.from_param, N.array([[1,2,3]]))
-
-if __name__ == "__main__":
- NumpyTest().run()