summaryrefslogtreecommitdiff
path: root/doc/swig
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-06 13:25:26 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-06 13:25:26 -0600
commitbb726ca19f434f5055c0efceefe48d89469fcbbe (patch)
tree889782afaf67fd5acb5f222969251871c0c46e5a /doc/swig
parent7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff)
downloadnumpy-bb726ca19f434f5055c0efceefe48d89469fcbbe.tar.gz
2to3: Apply `print` fixer.
Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
Diffstat (limited to 'doc/swig')
-rwxr-xr-xdoc/swig/test/setup.py2
-rwxr-xr-xdoc/swig/test/testArray.py8
-rwxr-xr-xdoc/swig/test/testFarray.py8
-rw-r--r--doc/swig/test/testFortran.py14
-rwxr-xr-xdoc/swig/test/testMatrix.py62
-rwxr-xr-xdoc/swig/test/testTensor.py62
-rwxr-xr-xdoc/swig/test/testVector.py70
7 files changed, 113 insertions, 113 deletions
diff --git a/doc/swig/test/setup.py b/doc/swig/test/setup.py
index 6395ffe46..c54b42ed4 100755
--- a/doc/swig/test/setup.py
+++ b/doc/swig/test/setup.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division
+from __future__ import division, print_function
# System imports
from distutils.core import *
diff --git a/doc/swig/test/testArray.py b/doc/swig/test/testArray.py
index 433dfb1bd..de744ce37 100755
--- a/doc/swig/test/testArray.py
+++ b/doc/swig/test/testArray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -277,8 +277,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite(Array2TestCase))
# Execute the test suite
- print "Testing Classes of Module Array"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Array")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testFarray.py b/doc/swig/test/testFarray.py
index c0699b07d..3905e26bd 100755
--- a/doc/swig/test/testFarray.py
+++ b/doc/swig/test/testFarray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -152,8 +152,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite(FarrayTestCase))
# Execute the test suite
- print "Testing Classes of Module Farray"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Farray")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testFortran.py b/doc/swig/test/testFortran.py
index 499f6a439..ae7415d50 100644
--- a/doc/swig/test/testFortran.py
+++ b/doc/swig/test/testFortran.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,14 +27,14 @@ class FortranTestCase(unittest.TestCase):
# Test (type* IN_FARRAY2, int DIM1, int DIM2) typemap
def testSecondElementContiguous(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.arange(9).reshape(3, 3).astype(self.typeCode)
self.assertEquals(second(matrix), 3)
def testSecondElementFortran(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray(np.arange(9).reshape(3, 3),
self.typeCode)
@@ -42,7 +42,7 @@ class FortranTestCase(unittest.TestCase):
def testSecondElementObject(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray([[0,1,2],[3,4,5],[6,7,8]], self.typeCode)
self.assertEquals(second(matrix), 3)
@@ -163,8 +163,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testMatrix.py b/doc/swig/test/testMatrix.py
index 187cd7214..d1721941e 100755
--- a/doc/swig/test/testMatrix.py
+++ b/doc/swig/test/testMatrix.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,7 +27,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDet(self):
"Test det function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7],[6,9]]
self.assertEquals(det(matrix), 30)
@@ -35,7 +35,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetBadList(self):
"Test det function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7], ["e", "pi"]]
self.assertRaises(BadListError, det, matrix)
@@ -43,7 +43,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongDim(self):
"Test det function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [8,7]
self.assertRaises(TypeError, det, matrix)
@@ -51,7 +51,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongSize(self):
"Test det function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7,6], [5,4,3], [2,1,0]]
self.assertRaises(TypeError, det, matrix)
@@ -59,14 +59,14 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetNonContainer(self):
"Test det function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
self.assertRaises(TypeError, det, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,5,4],[3,2,1]]
self.assertEquals(max(matrix), 6)
@@ -74,7 +74,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,"five",4], ["three", 2, "one"]]
self.assertRaises(BadListError, max, matrix)
@@ -82,21 +82,21 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, 1, 2, 3])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [[9,8],[7,6],[5,4]]
self.assertEquals(min(matrix), 4)
@@ -104,7 +104,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [["nine","eight"], ["seven","six"]]
self.assertRaises(BadListError, min, matrix)
@@ -112,21 +112,21 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [1,3,5,7,9])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, False)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
scale(matrix,4)
@@ -135,7 +135,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([1,2,2,1],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -143,7 +143,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2],[2,1]],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -151,7 +151,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],'c')
self.assertRaises(TypeError, scale, matrix)
@@ -159,7 +159,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = [[1,2,3],[2,1,2],[3,2,1]]
self.assertRaises(TypeError, scale, matrix)
@@ -167,7 +167,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7],[8,9]],self.typeCode)
floor(matrix,7)
@@ -176,7 +176,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongDim(self):
"Test floor function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([6,7,8,9],self.typeCode)
self.assertRaises(TypeError, floor, matrix)
@@ -184,7 +184,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7], [8,9]],'c')
self.assertRaises(TypeError, floor, matrix)
@@ -192,7 +192,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = [[6,7], [8,9]]
self.assertRaises(TypeError, floor, matrix)
@@ -200,7 +200,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2],[3,4]],self.typeCode)
ceil(matrix,3)
@@ -209,7 +209,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([1,2,3,4],self.typeCode)
self.assertRaises(TypeError, ceil, matrix)
@@ -217,7 +217,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongType(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2], [3,4]],'c')
self.assertRaises(TypeError, ceil, matrix)
@@ -225,7 +225,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = [[1,2], [3,4]]
self.assertRaises(TypeError, ceil, matrix)
@@ -233,7 +233,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type ARGOUT_ARRAY2[ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Matrix.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
@@ -355,8 +355,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testTensor.py b/doc/swig/test/testTensor.py
index cd9cada46..b6dd2e98a 100755
--- a/doc/swig/test/testTensor.py
+++ b/doc/swig/test/testTensor.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -29,7 +29,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNorm(self):
"Test norm function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1], [2,3]],
[[3,2], [1,0]]]
@@ -41,7 +41,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormBadList(self):
"Test norm function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,"one"],[2,3]],
[[3,"two"],[1,0]]]
@@ -50,7 +50,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongDim(self):
"Test norm function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[0,1,2,3],
[3,2,1,0]]
@@ -59,7 +59,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongSize(self):
"Test norm function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1,0], [2,3,2]],
[[3,2,3], [1,0,1]]]
@@ -68,14 +68,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormNonContainer(self):
"Test norm function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
self.assertRaises(TypeError, norm, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,2], [3,4]],
[[5,6], [7,8]]]
@@ -84,7 +84,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,"two"], [3,4]],
[[5,"six"], [7,8]]]
@@ -93,21 +93,21 @@ class TensorTestCase(unittest.TestCase):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, -1, 2, -3])
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -116,7 +116,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[["nine",8], [7,6]],
[["five",4], [3,2]]]
@@ -125,21 +125,21 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, True)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [[1,3],[5,7]])
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -152,7 +152,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -162,7 +162,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[1,0,1], [0,1,0], [1,0,1],
[0,1,0], [1,0,1], [0,1,0]],self.typeCode)
@@ -171,7 +171,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0], [0,1], [1,0]],
[[0,1], [1,0], [0,1]],
@@ -181,14 +181,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
self.assertRaises(TypeError, scale, True)
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],self.typeCode)
@@ -199,7 +199,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],'c')
@@ -208,7 +208,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongDim(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
self.assertRaises(TypeError, floor, tensor)
@@ -216,14 +216,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
self.assertRaises(TypeError, floor, object)
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],self.typeCode)
@@ -234,7 +234,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongType(self):
"Test ceil function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],'c')
@@ -243,7 +243,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
self.assertRaises(TypeError, ceil, tensor)
@@ -251,7 +251,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -260,7 +260,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type ARGOUT_ARRAY3[ANY][ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Tensor.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[[1,1], [1,1]],
[[1,1], [1,1]]])
@@ -395,8 +395,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 3D Functions of Module Tensor"
- print "NumPy version", np.__version__
- print
+ print("Testing 3D Functions of Module Tensor")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testVector.py b/doc/swig/test/testVector.py
index 29a77d281..d644e464c 100755
--- a/doc/swig/test/testVector.py
+++ b/doc/swig/test/testVector.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,98 +27,98 @@ class VectorTestCase(unittest.TestCase):
# Test the (type IN_ARRAY1[ANY]) typemap
def testLength(self):
"Test length function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertEquals(length([5, 12, 0]), 13)
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthBadList(self):
"Test length function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(BadListError, length, [5, "twelve", 0])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongSize(self):
"Test length function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [5, 12])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongDim(self):
"Test length function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [[1,2], [3,4]])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthNonContainer(self):
"Test length function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, None)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProd(self):
"Test prod function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertEquals(prod([1,2,3,4]), 24)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdBadList(self):
"Test prod function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(BadListError, prod, [[1,"two"], ["e","pi"]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdWrongDim(self):
"Test prod function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, [[1,2], [8,9]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdNonContainer(self):
"Test prod function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, None)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSum(self):
"Test sum function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertEquals(sum([5,6,7,8]), 26)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumBadList(self):
"Test sum function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(BadListError, sum, [3,4, 5, "pi"])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumWrongDim(self):
"Test sum function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, [[3,4], [5,6]])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumNonContainer(self):
"Test sum function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, True)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverse(self):
"Test reverse function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],self.typeCode)
reverse(vector)
@@ -127,7 +127,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongDim(self):
"Test reverse function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([[1,2], [3,4]],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -135,7 +135,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongSize(self):
"Test reverse function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([9,8,7,6,5,4],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -143,7 +143,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongType(self):
"Test reverse function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],'c')
self.assertRaises(TypeError, reverse, vector)
@@ -151,14 +151,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseNonArray(self):
"Test reverse function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
self.assertRaises(TypeError, reverse, [2,4,6])
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnes(self):
"Test ones function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros(5,self.typeCode)
ones(vector)
@@ -167,7 +167,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongDim(self):
"Test ones function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),self.typeCode)
self.assertRaises(TypeError, ones, vector)
@@ -175,7 +175,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongType(self):
"Test ones function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),'c')
self.assertRaises(TypeError, ones, vector)
@@ -183,14 +183,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesNonArray(self):
"Test ones function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
self.assertRaises(TypeError, ones, [2,4,6,8])
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZeros(self):
"Test zeros function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(5,self.typeCode)
zeros(vector)
@@ -199,7 +199,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongDim(self):
"Test zeros function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones((5,5),self.typeCode)
self.assertRaises(TypeError, zeros, vector)
@@ -207,7 +207,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongType(self):
"Test zeros function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(6,'c')
self.assertRaises(TypeError, zeros, vector)
@@ -215,14 +215,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosNonArray(self):
"Test zeros function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
self.assertRaises(TypeError, zeros, [1,3,5,7,9])
# Test the (type ARGOUT_ARRAY1[ANY]) typemap
def testEOSplit(self):
"Test eoSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
eoSplit = Vector.__dict__[self.typeStr + "EOSplit"]
even, odd = eoSplit([1,2,3])
self.assertEquals((even == [1,0,3]).all(), True)
@@ -231,7 +231,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwos(self):
"Test twos function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
vector = twos(5)
self.assertEquals((vector == [2,2,2,2,2]).all(), True)
@@ -239,14 +239,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwosNonInt(self):
"Test twos function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
self.assertRaises(TypeError, twos, 5.0)
# Test the (int DIM1, type* ARGOUT_ARRAY1) typemap
def testThrees(self):
"Test threes function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
vector = threes(6)
self.assertEquals((vector == [3,3,3,3,3,3]).all(), True)
@@ -254,7 +254,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testThreesNonInt(self):
"Test threes function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
self.assertRaises(TypeError, threes, "threes")
@@ -374,8 +374,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 1D Functions of Module Vector"
- print "NumPy version", np.__version__
- print
+ print("Testing 1D Functions of Module Vector")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))