summaryrefslogtreecommitdiff
path: root/numpy/doc/swig/test2D.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/doc/swig/test2D.py')
-rwxr-xr-xnumpy/doc/swig/test2D.py246
1 files changed, 112 insertions, 134 deletions
diff --git a/numpy/doc/swig/test2D.py b/numpy/doc/swig/test2D.py
index 7eb7a56e5..601e2c2b0 100755
--- a/numpy/doc/swig/test2D.py
+++ b/numpy/doc/swig/test2D.py
@@ -16,58 +16,58 @@ else: BadListError = ValueError
# import the extension module
libDir = "lib.%s-%s" % (get_platform(), sys.version[:3])
sys.path.insert(0,os.path.join("build", libDir))
-import Series
+import Matrix
######################################################################
-class SeriesTestCase(unittest.TestCase):
+class MatrixTestCase(unittest.TestCase):
####################################################
### Test functions that take arrays of type BYTE ###
def testScharDet(self):
"Test scharDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.scharDet(matrix), -2)
+ self.assertEquals(Matrix.scharDet(matrix), -2)
def testScharMax(self):
"Test scharMax function"
matrix = [[-6,5,-4],[3,-2,1]]
- self.assertEquals(Series.scharMax(matrix), 5)
+ self.assertEquals(Matrix.scharMax(matrix), 5)
def testScharMaxNonContainer(self):
"Test scharMax function with None"
- self.assertRaises(TypeError, Series.scharMax, None)
+ self.assertRaises(TypeError, Matrix.scharMax, None)
def testScharMaxWrongDim(self):
"Test scharMax function with a 1D array"
- self.assertRaises(TypeError, Series.scharMax, [0, -1, 2, -3])
+ self.assertRaises(TypeError, Matrix.scharMax, [0, -1, 2, -3])
def testScharMin(self):
"Test scharMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.scharMin(matrix), 4)
+ self.assertEquals(Matrix.scharMin(matrix), 4)
def testScharScale(self):
"Test scharScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'b')
- Series.scharScale(matrix,4)
+ Matrix.scharScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testScharFloor(self):
"Test scharFloor function"
matrix = N.array([[10,-2],[-6,7]],'b')
- Series.scharFloor(matrix,0)
+ Matrix.scharFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testScharCeil(self):
"Test scharCeil function"
matrix = N.array([[10,-2],[-6,7]],'b')
- Series.scharCeil(matrix,5)
+ Matrix.scharCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testScharLUSplit(self):
"Test scharLUSplit function"
- lower, upper = Series.scharLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.scharLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -76,47 +76,47 @@ class SeriesTestCase(unittest.TestCase):
def testUcharDet(self):
"Test ucharDet function"
matrix = [[7,6],[9,8]]
- self.assertEquals(Series.ucharDet(matrix), 2)
+ self.assertEquals(Matrix.ucharDet(matrix), 2)
def testUcharMax(self):
"Test ucharMax function"
matrix = [[6,5,4],[3,2,1]]
- self.assertEquals(Series.ucharMax(matrix), 6)
+ self.assertEquals(Matrix.ucharMax(matrix), 6)
def testUcharMaxNonContainer(self):
"Test ucharMax function with None"
- self.assertRaises(TypeError, Series.ucharMax, None)
+ self.assertRaises(TypeError, Matrix.ucharMax, None)
def testUcharMaxWrongDim(self):
"Test ucharMax function with a 1D array"
- self.assertRaises(TypeError, Series.ucharMax, [0, 1, 2, 3])
+ self.assertRaises(TypeError, Matrix.ucharMax, [0, 1, 2, 3])
def testUcharMin(self):
"Test ucharMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.ucharMin(matrix), 4)
+ self.assertEquals(Matrix.ucharMin(matrix), 4)
def testUcharScale(self):
"Test ucharScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'B')
- Series.ucharScale(matrix,4)
+ Matrix.ucharScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testUcharFloor(self):
"Test ucharFloor function"
matrix = N.array([[10,2],[6,7]],'B')
- Series.ucharFloor(matrix,7)
+ Matrix.ucharFloor(matrix,7)
N.testing.assert_array_equal(matrix, N.array([[10,7],[7,7]]))
def testUcharCeil(self):
"Test ucharCeil function"
matrix = N.array([[10,2],[6,7]],'B')
- Series.ucharCeil(matrix,5)
+ Matrix.ucharCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,2],[5,5]]))
def testUcharLUSplit(self):
"Test ucharLUSplit function"
- lower, upper = Series.ucharLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.ucharLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -125,47 +125,47 @@ class SeriesTestCase(unittest.TestCase):
def testShortDet(self):
"Test shortDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.shortDet(matrix), -2)
+ self.assertEquals(Matrix.shortDet(matrix), -2)
def testShortMax(self):
"Test shortMax function"
matrix = [[-6,5,-4],[3,-2,1]]
- self.assertEquals(Series.shortMax(matrix), 5)
+ self.assertEquals(Matrix.shortMax(matrix), 5)
def testShortMaxNonContainer(self):
"Test shortMax function with None"
- self.assertRaises(TypeError, Series.shortMax, None)
+ self.assertRaises(TypeError, Matrix.shortMax, None)
def testShortMaxWrongDim(self):
"Test shortMax function with a 1D array"
- self.assertRaises(TypeError, Series.shortMax, [0, -1, 2, -3])
+ self.assertRaises(TypeError, Matrix.shortMax, [0, -1, 2, -3])
def testShortMin(self):
"Test shortMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.shortMin(matrix), 4)
+ self.assertEquals(Matrix.shortMin(matrix), 4)
def testShortScale(self):
"Test shortScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'h')
- Series.shortScale(matrix,4)
+ Matrix.shortScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testShortFloor(self):
"Test shortFloor function"
matrix = N.array([[10,-2],[-6,7]],'h')
- Series.shortFloor(matrix,0)
+ Matrix.shortFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testShortCeil(self):
"Test shortCeil function"
matrix = N.array([[10,-2],[-6,7]],'h')
- Series.shortCeil(matrix,5)
+ Matrix.shortCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testShortLUSplit(self):
"Test shortLUSplit function"
- lower, upper = Series.shortLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.shortLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -174,47 +174,47 @@ class SeriesTestCase(unittest.TestCase):
def testUshortDet(self):
"Test ushortDet function"
matrix = [[7,6],[9,8]]
- self.assertEquals(Series.ushortDet(matrix), 2)
+ self.assertEquals(Matrix.ushortDet(matrix), 2)
def testUshortMax(self):
"Test ushortMax function"
matrix = [[6,5,4],[3,2,1]]
- self.assertEquals(Series.ushortMax(matrix), 6)
+ self.assertEquals(Matrix.ushortMax(matrix), 6)
def testUshortMaxNonContainer(self):
"Test ushortMax function with None"
- self.assertRaises(TypeError, Series.ushortMax, None)
+ self.assertRaises(TypeError, Matrix.ushortMax, None)
def testUshortMaxWrongDim(self):
"Test ushortMax function with a 1D array"
- self.assertRaises(TypeError, Series.ushortMax, [0, 1, 2, 3])
+ self.assertRaises(TypeError, Matrix.ushortMax, [0, 1, 2, 3])
def testUshortMin(self):
"Test ushortMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.ushortMin(matrix), 4)
+ self.assertEquals(Matrix.ushortMin(matrix), 4)
def testUshortScale(self):
"Test ushortScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'H')
- Series.ushortScale(matrix,4)
+ Matrix.ushortScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testUshortFloor(self):
"Test ushortFloor function"
matrix = N.array([[10,2],[6,7]],'H')
- Series.ushortFloor(matrix,7)
+ Matrix.ushortFloor(matrix,7)
N.testing.assert_array_equal(matrix, N.array([[10,7],[7,7]]))
def testUshortCeil(self):
"Test ushortCeil function"
matrix = N.array([[10,2],[6,7]],'H')
- Series.ushortCeil(matrix,5)
+ Matrix.ushortCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,2],[5,5]]))
def testUshortLUSplit(self):
"Test ushortLUSplit function"
- lower, upper = Series.ushortLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.ushortLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -223,47 +223,47 @@ class SeriesTestCase(unittest.TestCase):
def testIntDet(self):
"Test intDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.intDet(matrix), -2)
+ self.assertEquals(Matrix.intDet(matrix), -2)
def testIntMax(self):
"Test intMax function"
matrix = [[-6,5,-4],[3,-2,1]]
- self.assertEquals(Series.intMax(matrix), 5)
+ self.assertEquals(Matrix.intMax(matrix), 5)
def testIntMaxNonContainer(self):
"Test intMax function with None"
- self.assertRaises(TypeError, Series.intMax, None)
+ self.assertRaises(TypeError, Matrix.intMax, None)
def testIntMaxWrongDim(self):
"Test intMax function with a 1D array"
- self.assertRaises(TypeError, Series.intMax, [0, -1, 2, -3])
+ self.assertRaises(TypeError, Matrix.intMax, [0, -1, 2, -3])
def testIntMin(self):
"Test intMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.intMin(matrix), 4)
+ self.assertEquals(Matrix.intMin(matrix), 4)
def testIntScale(self):
"Test intScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'i')
- Series.intScale(matrix,4)
+ Matrix.intScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testIntFloor(self):
"Test intFloor function"
matrix = N.array([[10,-2],[-6,7]],'i')
- Series.intFloor(matrix,0)
+ Matrix.intFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testIntCeil(self):
"Test intCeil function"
matrix = N.array([[10,-2],[-6,7]],'i')
- Series.intCeil(matrix,5)
+ Matrix.intCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testIntLUSplit(self):
"Test intLUSplit function"
- lower, upper = Series.intLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.intLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -272,47 +272,47 @@ class SeriesTestCase(unittest.TestCase):
def testUintDet(self):
"Test uintDet function"
matrix = [[7,6],[9,8]]
- self.assertEquals(Series.uintDet(matrix), 2)
+ self.assertEquals(Matrix.uintDet(matrix), 2)
def testUintMax(self):
"Test uintMax function"
matrix = [[6,5,4],[3,2,1]]
- self.assertEquals(Series.uintMax(matrix), 6)
+ self.assertEquals(Matrix.uintMax(matrix), 6)
def testUintMaxNonContainer(self):
"Test uintMax function with None"
- self.assertRaises(TypeError, Series.uintMax, None)
+ self.assertRaises(TypeError, Matrix.uintMax, None)
def testUintMaxWrongDim(self):
"Test uintMax function with a 1D array"
- self.assertRaises(TypeError, Series.uintMax, [0, 1, 2, 3])
+ self.assertRaises(TypeError, Matrix.uintMax, [0, 1, 2, 3])
def testUintMin(self):
"Test uintMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.uintMin(matrix), 4)
+ self.assertEquals(Matrix.uintMin(matrix), 4)
def testUintScale(self):
"Test uintScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'I')
- Series.uintScale(matrix,4)
+ Matrix.uintScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testUintFloor(self):
"Test uintFloor function"
matrix = N.array([[10,2],[6,7]],'I')
- Series.uintFloor(matrix,7)
+ Matrix.uintFloor(matrix,7)
N.testing.assert_array_equal(matrix, N.array([[10,7],[7,7]]))
def testUintCeil(self):
"Test uintCeil function"
matrix = N.array([[10,2],[6,7]],'I')
- Series.uintCeil(matrix,5)
+ Matrix.uintCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,2],[5,5]]))
def testUintLUSplit(self):
"Test uintLUSplit function"
- lower, upper = Series.uintLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.uintLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -321,47 +321,47 @@ class SeriesTestCase(unittest.TestCase):
def testLongDet(self):
"Test longDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.longDet(matrix), -2)
+ self.assertEquals(Matrix.longDet(matrix), -2)
def testLongMax(self):
"Test longMax function"
matrix = [[-6,5,-4],[3,-2,1]]
- self.assertEquals(Series.longMax(matrix), 5)
+ self.assertEquals(Matrix.longMax(matrix), 5)
def testLongMaxNonContainer(self):
"Test longMax function with None"
- self.assertRaises(TypeError, Series.longMax, None)
+ self.assertRaises(TypeError, Matrix.longMax, None)
def testLongMaxWrongDim(self):
"Test longMax function with a 1D array"
- self.assertRaises(TypeError, Series.longMax, [0, -1, 2, -3])
+ self.assertRaises(TypeError, Matrix.longMax, [0, -1, 2, -3])
def testLongMin(self):
"Test longMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.longMin(matrix), 4)
+ self.assertEquals(Matrix.longMin(matrix), 4)
def testLongScale(self):
"Test longScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'l')
- Series.longScale(matrix,4)
+ Matrix.longScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testLongFloor(self):
"Test longFloor function"
matrix = N.array([[10,-2],[-6,7]],'l')
- Series.longFloor(matrix,0)
+ Matrix.longFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testLongCeil(self):
"Test longCeil function"
matrix = N.array([[10,-2],[-6,7]],'l')
- Series.longCeil(matrix,5)
+ Matrix.longCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testLongLUSplit(self):
"Test longLUSplit function"
- lower, upper = Series.longLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.longLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -370,47 +370,47 @@ class SeriesTestCase(unittest.TestCase):
def testUlongDet(self):
"Test ulongDet function"
matrix = [[7,6],[9,8]]
- self.assertEquals(Series.ulongDet(matrix), 2)
+ self.assertEquals(Matrix.ulongDet(matrix), 2)
def testUlongMax(self):
"Test ulongMax function"
matrix = [[6,5,4],[3,2,1]]
- self.assertEquals(Series.ulongMax(matrix), 6)
+ self.assertEquals(Matrix.ulongMax(matrix), 6)
def testUlongMaxNonContainer(self):
"Test ulongMax function with None"
- self.assertRaises(TypeError, Series.ulongMax, None)
+ self.assertRaises(TypeError, Matrix.ulongMax, None)
def testUlongMaxWrongDim(self):
"Test ulongMax function with a 1D array"
- self.assertRaises(TypeError, Series.ulongMax, [0, 1, 2, 3])
+ self.assertRaises(TypeError, Matrix.ulongMax, [0, 1, 2, 3])
def testUlongMin(self):
"Test ulongMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.ulongMin(matrix), 4)
+ self.assertEquals(Matrix.ulongMin(matrix), 4)
def testUlongScale(self):
"Test ulongScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'L')
- Series.ulongScale(matrix,4)
+ Matrix.ulongScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testUlongFloor(self):
"Test ulongFloor function"
matrix = N.array([[10,2],[6,7]],'L')
- Series.ulongFloor(matrix,7)
+ Matrix.ulongFloor(matrix,7)
N.testing.assert_array_equal(matrix, N.array([[10,7],[7,7]]))
def testUlongCeil(self):
"Test ulongCeil function"
matrix = N.array([[10,2],[6,7]],'L')
- Series.ulongCeil(matrix,5)
+ Matrix.ulongCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,2],[5,5]]))
def testUlongLUSplit(self):
"Test ulongLUSplit function"
- lower, upper = Series.ulongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.ulongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -419,47 +419,47 @@ class SeriesTestCase(unittest.TestCase):
def testLongLongDet(self):
"Test longLongDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.longLongDet(matrix), -2)
+ self.assertEquals(Matrix.longLongDet(matrix), -2)
def testLongLongMax(self):
"Test longLongMax function"
matrix = [[-6,5,-4],[3,-2,1]]
- self.assertEquals(Series.longLongMax(matrix), 5)
+ self.assertEquals(Matrix.longLongMax(matrix), 5)
def testLongLongMaxNonContainer(self):
"Test longLongMax function with None"
- self.assertRaises(TypeError, Series.longLongMax, None)
+ self.assertRaises(TypeError, Matrix.longLongMax, None)
def testLongLongMaxWrongDim(self):
"Test longLongMax function with a 1D array"
- self.assertRaises(TypeError, Series.longLongMax, [0, -1, 2, -3])
+ self.assertRaises(TypeError, Matrix.longLongMax, [0, -1, 2, -3])
def testLongLongMin(self):
"Test longLongMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.longLongMin(matrix), 4)
+ self.assertEquals(Matrix.longLongMin(matrix), 4)
def testLongLongScale(self):
"Test longLongScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'q')
- Series.longLongScale(matrix,4)
+ Matrix.longLongScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testLongLongFloor(self):
"Test longLongFloor function"
matrix = N.array([[10,-2],[-6,7]],'q')
- Series.longLongFloor(matrix,0)
+ Matrix.longLongFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testLongLongCeil(self):
"Test longLongCeil function"
matrix = N.array([[10,-2],[-6,7]],'q')
- Series.longLongCeil(matrix,5)
+ Matrix.longLongCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testLongLongLUSplit(self):
"Test longLongLUSplit function"
- lower, upper = Series.longLongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.longLongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -468,47 +468,47 @@ class SeriesTestCase(unittest.TestCase):
def testUlongLongDet(self):
"Test ulongLongDet function"
matrix = [[7,6],[9,8]]
- self.assertEquals(Series.ulongLongDet(matrix), 2)
+ self.assertEquals(Matrix.ulongLongDet(matrix), 2)
def testUlongLongMax(self):
"Test ulongLongMax function"
matrix = [[6,5,4],[3,2,1]]
- self.assertEquals(Series.ulongLongMax(matrix), 6)
+ self.assertEquals(Matrix.ulongLongMax(matrix), 6)
def testUlongLongMaxNonContainer(self):
"Test ulongLongMax function with None"
- self.assertRaises(TypeError, Series.ulongLongMax, None)
+ self.assertRaises(TypeError, Matrix.ulongLongMax, None)
def testUlongLongMaxWrongDim(self):
"Test ulongLongMax function with a 1D array"
- self.assertRaises(TypeError, Series.ulongLongMax, [0, 1, 2, 3])
+ self.assertRaises(TypeError, Matrix.ulongLongMax, [0, 1, 2, 3])
def testUlongLongMin(self):
"Test ulongLongMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.ulongLongMin(matrix), 4)
+ self.assertEquals(Matrix.ulongLongMin(matrix), 4)
def testUlongLongScale(self):
"Test ulongLongScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'Q')
- Series.ulongLongScale(matrix,4)
+ Matrix.ulongLongScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testUlongLongFloor(self):
"Test ulongLongFloor function"
matrix = N.array([[10,2],[6,7]],'Q')
- Series.ulongLongFloor(matrix,7)
+ Matrix.ulongLongFloor(matrix,7)
N.testing.assert_array_equal(matrix, N.array([[10,7],[7,7]]))
def testUlongLongCeil(self):
"Test ulongLongCeil function"
matrix = N.array([[10,2],[6,7]],'Q')
- Series.ulongLongCeil(matrix,5)
+ Matrix.ulongLongCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,2],[5,5]]))
def testUlongLongLUSplit(self):
"Test ulongLongLUSplit function"
- lower, upper = Series.ulongLongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.ulongLongLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -517,69 +517,47 @@ class SeriesTestCase(unittest.TestCase):
def testFloatDet(self):
"Test floatDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.floatDet(matrix), -2)
-
- def testFloatZeros(self):
- "Test floatZeros function"
- myArray = N.ones(5,'f')
- Series.floatZeros(myArray)
- N.testing.assert_array_equal(myArray, N.array([0,0,0,0,0]))
-
- def testFloatEOSplit(self):
- "Test floatEOSplit function"
- even, odd = Series.floatEOSplit([1,2,3])
- self.assertEquals((even == [1,0,3]).all(), True)
- self.assertEquals((odd == [0,2,0]).all(), True)
-
- def testFloatTwos(self):
- "Test floatTwos function"
- twos = Series.floatTwos(5)
- self.assertEquals((twos == [2,2,2,2,2]).all(), True)
-
- def testFloatThrees(self):
- "Test floatThrees function"
- threes = Series.floatThrees(6)
- self.assertEquals((threes == [3,3,3,3,3,3]).all(), True)
+ self.assertEquals(Matrix.floatDet(matrix), -2)
def testFloatMax(self):
"Test floatMax function"
matrix = [[-6,5,-4],[3.14,-2.718,1]]
- self.assertEquals(Series.floatMax(matrix), 5.0)
+ self.assertEquals(Matrix.floatMax(matrix), 5.0)
def testFloatMaxNonContainer(self):
"Test floatMax function with None"
- self.assertRaises(TypeError, Series.floatMax, None)
+ self.assertRaises(TypeError, Matrix.floatMax, None)
def testFloatMaxWrongDim(self):
"Test floatMax function with a 1D array"
- self.assertRaises(TypeError, Series.floatMax, [0.0, -1, 2.718, -3.14])
+ self.assertRaises(TypeError, Matrix.floatMax, [0.0, -1, 2.718, -3.14])
def testFloatMin(self):
"Test floatMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.floatMin(matrix), 4)
+ self.assertEquals(Matrix.floatMin(matrix), 4)
def testFloatScale(self):
"Test floatScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'f')
- Series.floatScale(matrix,4)
+ Matrix.floatScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testFloatFloor(self):
"Test floatFloor function"
matrix = N.array([[10,-2],[-6,7]],'f')
- Series.floatFloor(matrix,0)
+ Matrix.floatFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testFloatCeil(self):
"Test floatCeil function"
matrix = N.array([[10,-2],[-6,7]],'f')
- Series.floatCeil(matrix,5)
+ Matrix.floatCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testFloatLUSplit(self):
"Test floatLUSplit function"
- lower, upper = Series.floatLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.floatLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -588,47 +566,47 @@ class SeriesTestCase(unittest.TestCase):
def testDoubleDet(self):
"Test doubleDet function"
matrix = [[6,7],[8,9]]
- self.assertEquals(Series.doubleDet(matrix), -2)
+ self.assertEquals(Matrix.doubleDet(matrix), -2)
def testDoubleMax(self):
"Test doubleMax function"
matrix = [[-6,5,-4],[3.14,-2.718,1]]
- self.assertEquals(Series.doubleMax(matrix), 5.0)
+ self.assertEquals(Matrix.doubleMax(matrix), 5.0)
def testDoubleMaxNonContainer(self):
"Test doubleMax function with None"
- self.assertRaises(TypeError, Series.doubleMax, None)
+ self.assertRaises(TypeError, Matrix.doubleMax, None)
def testDoubleMaxWrongDim(self):
"Test doubleMax function with a 1D array"
- self.assertRaises(TypeError, Series.doubleMax, [0.0, -1, 2.718, -3.14])
+ self.assertRaises(TypeError, Matrix.doubleMax, [0.0, -1, 2.718, -3.14])
def testDoubleMin(self):
"Test doubleMin function"
matrix = [[9,8],[7,6],[5,4]]
- self.assertEquals(Series.doubleMin(matrix), 4)
+ self.assertEquals(Matrix.doubleMin(matrix), 4)
def testDoubleScale(self):
"Test doubleScale function"
matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'d')
- Series.doubleScale(matrix,4)
+ Matrix.doubleScale(matrix,4)
self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
def testDoubleFloor(self):
"Test doubleFloor function"
matrix = N.array([[10,-2],[-6,7]],'d')
- Series.doubleFloor(matrix,0)
+ Matrix.doubleFloor(matrix,0)
N.testing.assert_array_equal(matrix, N.array([[10,0],[0,7]]))
def testDoubleCeil(self):
"Test doubleCeil function"
matrix = N.array([[10,-2],[-6,7]],'d')
- Series.doubleCeil(matrix,5)
+ Matrix.doubleCeil(matrix,5)
N.testing.assert_array_equal(matrix, N.array([[5,-2],[-6,5]]))
def testDoubleLUSplit(self):
"Test doubleLUSplit function"
- lower, upper = Series.doubleLUSplit([[1,2,3],[4,5,6],[7,8,9]])
+ lower, upper = Matrix.doubleLUSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
self.assertEquals((upper == [[0,2,3],[0,0,6],[0,0,0]]).all(), True)
@@ -638,10 +616,10 @@ if __name__ == "__main__":
# Build the test suite
suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(SeriesTestCase))
+ suite.addTest(unittest.makeSuite(MatrixTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Series"
+ print "Testing 2D Functions of Module Matrix"
print "NumPy version", N.__version__
print
result = unittest.TextTestRunner(verbosity=2).run(suite)