summaryrefslogtreecommitdiff
path: root/doc/swig/test/testVector.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/swig/test/testVector.py')
-rwxr-xr-xdoc/swig/test/testVector.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/doc/swig/test/testVector.py b/doc/swig/test/testVector.py
index d644e464c..e7d019cf7 100755
--- a/doc/swig/test/testVector.py
+++ b/doc/swig/test/testVector.py
@@ -50,7 +50,7 @@ class VectorTestCase(unittest.TestCase):
"Test length function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
- self.assertRaises(TypeError, length, [[1,2], [3,4]])
+ self.assertRaises(TypeError, length, [[1, 2], [3, 4]])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthNonContainer(self):
@@ -64,21 +64,21 @@ class VectorTestCase(unittest.TestCase):
"Test prod function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
- self.assertEquals(prod([1,2,3,4]), 24)
+ 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(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
- self.assertRaises(BadListError, prod, [[1,"two"], ["e","pi"]])
+ 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(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
- self.assertRaises(TypeError, prod, [[1,2], [8,9]])
+ self.assertRaises(TypeError, prod, [[1, 2], [8, 9]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdNonContainer(self):
@@ -92,21 +92,21 @@ class VectorTestCase(unittest.TestCase):
"Test sum function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
- self.assertEquals(sum([5,6,7,8]), 26)
+ 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(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
- self.assertRaises(BadListError, sum, [3,4, 5, "pi"])
+ 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(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
- self.assertRaises(TypeError, sum, [[3,4], [5,6]])
+ self.assertRaises(TypeError, sum, [[3, 4], [5, 6]])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumNonContainer(self):
@@ -120,16 +120,16 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = np.array([1,2,4],self.typeCode)
+ vector = np.array([1, 2, 4], self.typeCode)
reverse(vector)
- self.assertEquals((vector == [4,2,1]).all(), True)
+ self.assertEquals((vector == [4, 2, 1]).all(), True)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongDim(self):
"Test reverse function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = np.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
@@ -137,7 +137,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with wrong size"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = np.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
@@ -145,7 +145,7 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with wrong type"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- vector = np.array([1,2,4],'c')
+ vector = np.array([1, 2, 4], 'c')
self.assertRaises(TypeError, reverse, vector)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -153,23 +153,23 @@ class VectorTestCase(unittest.TestCase):
"Test reverse function with non-array"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
- self.assertRaises(TypeError, reverse, [2,4,6])
+ self.assertRaises(TypeError, reverse, [2, 4, 6])
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnes(self):
"Test ones function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = np.zeros(5,self.typeCode)
+ vector = np.zeros(5, self.typeCode)
ones(vector)
- np.testing.assert_array_equal(vector, np.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(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = np.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
@@ -177,7 +177,7 @@ class VectorTestCase(unittest.TestCase):
"Test ones function with wrong type"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
- vector = np.zeros((5,5),'c')
+ vector = np.zeros((5, 5), 'c')
self.assertRaises(TypeError, ones, vector)
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
@@ -185,23 +185,23 @@ class VectorTestCase(unittest.TestCase):
"Test ones function with non-array"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
- self.assertRaises(TypeError, ones, [2,4,6,8])
+ self.assertRaises(TypeError, ones, [2, 4, 6, 8])
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZeros(self):
"Test zeros function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = np.ones(5,self.typeCode)
+ vector = np.ones(5, self.typeCode)
zeros(vector)
- np.testing.assert_array_equal(vector, np.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(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = np.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
@@ -209,7 +209,7 @@ class VectorTestCase(unittest.TestCase):
"Test zeros function with wrong type"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- vector = np.ones(6,'c')
+ vector = np.ones(6, 'c')
self.assertRaises(TypeError, zeros, vector)
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
@@ -217,16 +217,16 @@ class VectorTestCase(unittest.TestCase):
"Test zeros function with non-array"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
- self.assertRaises(TypeError, zeros, [1,3,5,7,9])
+ self.assertRaises(TypeError, zeros, [1, 3, 5, 7, 9])
# Test the (type ARGOUT_ARRAY1[ANY]) typemap
def testEOSplit(self):
"Test eoSplit function"
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)
- self.assertEquals((odd == [0,2,0]).all(), True)
+ even, odd = eoSplit([1, 2, 3])
+ self.assertEquals((even == [1, 0, 3]).all(), True)
+ self.assertEquals((odd == [0, 2, 0]).all(), True)
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwos(self):
@@ -234,7 +234,7 @@ class VectorTestCase(unittest.TestCase):
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)
+ self.assertEquals((vector == [2, 2, 2, 2, 2]).all(), True)
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwosNonInt(self):
@@ -249,7 +249,7 @@ class VectorTestCase(unittest.TestCase):
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)
+ self.assertEquals((vector == [3, 3, 3, 3, 3, 3]).all(), True)
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testThreesNonInt(self):