summaryrefslogtreecommitdiff
path: root/doc/swig/test/testTensor.py
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/test/testTensor.py
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/test/testTensor.py')
-rwxr-xr-xdoc/swig/test/testTensor.py62
1 files changed, 31 insertions, 31 deletions
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))