summaryrefslogtreecommitdiff
path: root/numpy/doc/swig
diff options
context:
space:
mode:
authorJarrod Millman <millman@berkeley.edu>2007-12-29 02:21:56 +0000
committerJarrod Millman <millman@berkeley.edu>2007-12-29 02:21:56 +0000
commit72297ed57ac666c6ef50d5c88ef486a94f7fc080 (patch)
tree9ee064e4147d76e2b154e35103a7f46a6b3081c6 /numpy/doc/swig
parent423b1953b1742a2b71cc766ff08a919707f19e1c (diff)
downloadnumpy-72297ed57ac666c6ef50d5c88ef486a94f7fc080.tar.gz
more janitorial work
Diffstat (limited to 'numpy/doc/swig')
-rwxr-xr-xnumpy/doc/swig/test/testFarray.py8
-rwxr-xr-xnumpy/doc/swig/test/testMatrix.py30
-rwxr-xr-xnumpy/doc/swig/test/testTensor.py30
-rwxr-xr-xnumpy/doc/swig/test/testVector.py30
4 files changed, 49 insertions, 49 deletions
diff --git a/numpy/doc/swig/test/testFarray.py b/numpy/doc/swig/test/testFarray.py
index 47c39136a..614e149bd 100755
--- a/numpy/doc/swig/test/testFarray.py
+++ b/numpy/doc/swig/test/testFarray.py
@@ -7,8 +7,8 @@ import sys
import unittest
# Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
@@ -136,7 +136,7 @@ class FarrayTestCase(unittest.TestCase):
for j in range(self.ncols):
self.array[i,j] = i+j
a = self.array.view()
- self.failUnless(isinstance(a, N.ndarray))
+ self.failUnless(isinstance(a, np.ndarray))
self.failUnless(a.flags.f_contiguous)
for i in range(self.nrows):
for j in range(self.ncols):
@@ -152,7 +152,7 @@ if __name__ == "__main__":
# Execute the test suite
print "Testing Classes of Module Farray"
- print "NumPy version", N.__version__
+ print "NumPy version", np.__version__
print
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/numpy/doc/swig/test/testMatrix.py b/numpy/doc/swig/test/testMatrix.py
index 933423fe9..f78dd2be2 100755
--- a/numpy/doc/swig/test/testMatrix.py
+++ b/numpy/doc/swig/test/testMatrix.py
@@ -7,8 +7,8 @@ import sys
import unittest
# Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
@@ -131,7 +131,7 @@ class MatrixTestCase(unittest.TestCase):
"Test scale function"
print >>sys.stderr, self.typeStr, "... ",
scale = Matrix.__dict__[self.typeStr + "Scale"]
- matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
+ matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
scale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
@@ -140,7 +140,7 @@ class MatrixTestCase(unittest.TestCase):
"Test scale function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
scale = Matrix.__dict__[self.typeStr + "Scale"]
- matrix = N.array([1,2,2,1],self.typeCode)
+ matrix = np.array([1,2,2,1],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -148,7 +148,7 @@ class MatrixTestCase(unittest.TestCase):
"Test scale function with wrong size"
print >>sys.stderr, self.typeStr, "... ",
scale = Matrix.__dict__[self.typeStr + "Scale"]
- matrix = N.array([[1,2],[2,1]],self.typeCode)
+ matrix = np.array([[1,2],[2,1]],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -156,7 +156,7 @@ class MatrixTestCase(unittest.TestCase):
"Test scale function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
scale = Matrix.__dict__[self.typeStr + "Scale"]
- matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'c')
+ matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],'c')
self.assertRaises(TypeError, scale, matrix)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -172,16 +172,16 @@ class MatrixTestCase(unittest.TestCase):
"Test floor function"
print >>sys.stderr, self.typeStr, "... ",
floor = Matrix.__dict__[self.typeStr + "Floor"]
- matrix = N.array([[6,7],[8,9]],self.typeCode)
+ matrix = np.array([[6,7],[8,9]],self.typeCode)
floor(matrix,7)
- N.testing.assert_array_equal(matrix, N.array([[7,7],[8,9]]))
+ np.testing.assert_array_equal(matrix, np.array([[7,7],[8,9]]))
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongDim(self):
"Test floor function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
floor = Matrix.__dict__[self.typeStr + "Floor"]
- matrix = N.array([6,7,8,9],self.typeCode)
+ matrix = np.array([6,7,8,9],self.typeCode)
self.assertRaises(TypeError, floor, matrix)
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
@@ -189,7 +189,7 @@ class MatrixTestCase(unittest.TestCase):
"Test floor function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
floor = Matrix.__dict__[self.typeStr + "Floor"]
- matrix = N.array([[6,7], [8,9]],'c')
+ matrix = np.array([[6,7], [8,9]],'c')
self.assertRaises(TypeError, floor, matrix)
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
@@ -205,16 +205,16 @@ class MatrixTestCase(unittest.TestCase):
"Test ceil function"
print >>sys.stderr, self.typeStr, "... ",
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
- matrix = N.array([[1,2],[3,4]],self.typeCode)
+ matrix = np.array([[1,2],[3,4]],self.typeCode)
ceil(matrix,3)
- N.testing.assert_array_equal(matrix, N.array([[1,2],[3,3]]))
+ np.testing.assert_array_equal(matrix, np.array([[1,2],[3,3]]))
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
- matrix = N.array([1,2,3,4],self.typeCode)
+ matrix = np.array([1,2,3,4],self.typeCode)
self.assertRaises(TypeError, ceil, matrix)
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
@@ -222,7 +222,7 @@ class MatrixTestCase(unittest.TestCase):
"Test ceil function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
- matrix = N.array([[1,2], [3,4]],'c')
+ matrix = np.array([[1,2], [3,4]],'c')
self.assertRaises(TypeError, ceil, matrix)
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
@@ -359,7 +359,7 @@ if __name__ == "__main__":
# Execute the test suite
print "Testing 2D Functions of Module Matrix"
- print "NumPy version", N.__version__
+ print "NumPy version", np.__version__
print
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/numpy/doc/swig/test/testTensor.py b/numpy/doc/swig/test/testTensor.py
index f68e6b720..7d13a0757 100755
--- a/numpy/doc/swig/test/testTensor.py
+++ b/numpy/doc/swig/test/testTensor.py
@@ -8,8 +8,8 @@ import sys
import unittest
# Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
@@ -144,7 +144,7 @@ class TensorTestCase(unittest.TestCase):
"Test scale function"
print >>sys.stderr, self.typeStr, "... ",
scale = Tensor.__dict__[self.typeStr + "Scale"]
- tensor = N.array([[[1,0,1], [0,1,0], [1,0,1]],
+ tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
[[1,0,1], [0,1,0], [1,0,1]]],self.typeCode)
scale(tensor,4)
@@ -157,7 +157,7 @@ class TensorTestCase(unittest.TestCase):
"Test scale function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
scale = Tensor.__dict__[self.typeStr + "Scale"]
- tensor = N.array([[[1,0,1], [0,1,0], [1,0,1]],
+ tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
[[1,0,1], [0,1,0], [1,0,1]]],'c')
self.assertRaises(TypeError, scale, tensor)
@@ -167,7 +167,7 @@ class TensorTestCase(unittest.TestCase):
"Test scale function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
scale = Tensor.__dict__[self.typeStr + "Scale"]
- tensor = N.array([[1,0,1], [0,1,0], [1,0,1],
+ tensor = np.array([[1,0,1], [0,1,0], [1,0,1],
[0,1,0], [1,0,1], [0,1,0]],self.typeCode)
self.assertRaises(TypeError, scale, tensor)
@@ -176,7 +176,7 @@ class TensorTestCase(unittest.TestCase):
"Test scale function with wrong size"
print >>sys.stderr, self.typeStr, "... ",
scale = Tensor.__dict__[self.typeStr + "Scale"]
- tensor = N.array([[[1,0], [0,1], [1,0]],
+ tensor = np.array([[[1,0], [0,1], [1,0]],
[[0,1], [1,0], [0,1]],
[[1,0], [0,1], [1,0]]],self.typeCode)
self.assertRaises(TypeError, scale, tensor)
@@ -193,10 +193,10 @@ class TensorTestCase(unittest.TestCase):
"Test floor function"
print >>sys.stderr, self.typeStr, "... ",
floor = Tensor.__dict__[self.typeStr + "Floor"]
- tensor = N.array([[[1,2], [3,4]],
+ tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],self.typeCode)
floor(tensor,4)
- N.testing.assert_array_equal(tensor, N.array([[[4,4], [4,4]],
+ np.testing.assert_array_equal(tensor, np.array([[[4,4], [4,4]],
[[5,6], [7,8]]]))
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
@@ -204,7 +204,7 @@ class TensorTestCase(unittest.TestCase):
"Test floor function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
floor = Tensor.__dict__[self.typeStr + "Floor"]
- tensor = N.array([[[1,2], [3,4]],
+ tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],'c')
self.assertRaises(TypeError, floor, tensor)
@@ -213,7 +213,7 @@ class TensorTestCase(unittest.TestCase):
"Test floor function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
floor = Tensor.__dict__[self.typeStr + "Floor"]
- tensor = N.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
+ tensor = np.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
self.assertRaises(TypeError, floor, tensor)
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
@@ -228,10 +228,10 @@ class TensorTestCase(unittest.TestCase):
"Test ceil function"
print >>sys.stderr, self.typeStr, "... ",
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
- tensor = N.array([[[9,8], [7,6]],
+ tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],self.typeCode)
ceil(tensor,5)
- N.testing.assert_array_equal(tensor, N.array([[[5,5], [5,5]],
+ np.testing.assert_array_equal(tensor, np.array([[[5,5], [5,5]],
[[5,4], [3,2]]]))
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
@@ -239,7 +239,7 @@ class TensorTestCase(unittest.TestCase):
"Test ceil function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
- tensor = N.array([[[9,8], [7,6]],
+ tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],'c')
self.assertRaises(TypeError, ceil, tensor)
@@ -248,7 +248,7 @@ class TensorTestCase(unittest.TestCase):
"Test ceil function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
- tensor = N.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
+ tensor = np.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
self.assertRaises(TypeError, ceil, tensor)
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
@@ -399,7 +399,7 @@ if __name__ == "__main__":
# Execute the test suite
print "Testing 3D Functions of Module Tensor"
- print "NumPy version", N.__version__
+ print "NumPy version", np.__version__
print
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/numpy/doc/swig/test/testVector.py b/numpy/doc/swig/test/testVector.py
index 82a922e25..ed085aa94 100755
--- a/numpy/doc/swig/test/testVector.py
+++ b/numpy/doc/swig/test/testVector.py
@@ -7,8 +7,8 @@ import sys
import unittest
# Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else: BadListError = ValueError
@@ -123,7 +123,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function"
print >>sys.stderr, self.typeStr, "... ",
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = N.array([1,2,4],self.typeCode)
+ vector = np.array([1,2,4],self.typeCode)
reverse(vector)
self.assertEquals((vector == [4,2,1]).all(), True)
@@ -132,7 +132,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = N.array([[1,2], [3,4]],self.typeCode)
+ vector = np.array([[1,2], [3,4]],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -140,7 +140,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with wrong size"
print >>sys.stderr, self.typeStr, "... ",
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = N.array([9,8,7,6,5,4],self.typeCode)
+ vector = np.array([9,8,7,6,5,4],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -148,7 +148,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = N.array([1,2,4],'c')
+ vector = np.array([1,2,4],'c')
self.assertRaises(TypeError, reverse, vector)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -163,16 +163,16 @@ class VectorTestCase(unittest.TestCase):
"Test ones function"
print >>sys.stderr, self.typeStr, "... ",
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = N.zeros(5,self.typeCode)
+ vector = np.zeros(5,self.typeCode)
ones(vector)
- N.testing.assert_array_equal(vector, N.array([1,1,1,1,1]))
+ np.testing.assert_array_equal(vector, np.array([1,1,1,1,1]))
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongDim(self):
"Test ones function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = N.zeros((5,5),self.typeCode)
+ vector = np.zeros((5,5),self.typeCode)
self.assertRaises(TypeError, ones, vector)
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
@@ -180,7 +180,7 @@ class VectorTestCase(unittest.TestCase):
"Test ones function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = N.zeros((5,5),'c')
+ vector = np.zeros((5,5),'c')
self.assertRaises(TypeError, ones, vector)
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
@@ -195,16 +195,16 @@ class VectorTestCase(unittest.TestCase):
"Test zeros function"
print >>sys.stderr, self.typeStr, "... ",
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = N.ones(5,self.typeCode)
+ vector = np.ones(5,self.typeCode)
zeros(vector)
- N.testing.assert_array_equal(vector, N.array([0,0,0,0,0]))
+ np.testing.assert_array_equal(vector, np.array([0,0,0,0,0]))
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongDim(self):
"Test zeros function with wrong dimensions"
print >>sys.stderr, self.typeStr, "... ",
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = N.ones((5,5),self.typeCode)
+ vector = np.ones((5,5),self.typeCode)
self.assertRaises(TypeError, zeros, vector)
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
@@ -212,7 +212,7 @@ class VectorTestCase(unittest.TestCase):
"Test zeros function with wrong type"
print >>sys.stderr, self.typeStr, "... ",
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = N.ones(6,'c')
+ vector = np.ones(6,'c')
self.assertRaises(TypeError, zeros, vector)
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
@@ -378,7 +378,7 @@ if __name__ == "__main__":
# Execute the test suite
print "Testing 1D Functions of Module Vector"
- print "NumPy version", N.__version__
+ print "NumPy version", np.__version__
print
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))