diff options
author | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-06 19:45:03 +0000 |
---|---|---|
committer | wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> | 2007-04-06 19:45:03 +0000 |
commit | 9d14fc91d8d12395719a257917c363cf91400962 (patch) | |
tree | 6eab2a9fd3b479f8d9b852a804c0169cc73557be /numpy/doc/swig/testMatrix.py | |
parent | 4b9f5d9cbf52406eaebf28e7df4fd04e1024e708 (diff) | |
download | numpy-9d14fc91d8d12395719a257917c363cf91400962.tar.gz |
Added 'bad list' tests to IN_ARRAY typemap tests
Diffstat (limited to 'numpy/doc/swig/testMatrix.py')
-rwxr-xr-x | numpy/doc/swig/testMatrix.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/numpy/doc/swig/testMatrix.py b/numpy/doc/swig/testMatrix.py index cce16b792..933423fe9 100755 --- a/numpy/doc/swig/testMatrix.py +++ b/numpy/doc/swig/testMatrix.py @@ -36,6 +36,14 @@ class MatrixTestCase(unittest.TestCase): self.assertEquals(det(matrix), 30) # Test (type IN_ARRAY2[ANY][ANY]) typemap + def testDetBadList(self): + "Test det function with bad list" + print >>sys.stderr, self.typeStr, "... ", + det = Matrix.__dict__[self.typeStr + "Det"] + matrix = [[8,7], ["e", "pi"]] + self.assertRaises(BadListError, det, matrix) + + # Test (type IN_ARRAY2[ANY][ANY]) typemap def testDetWrongDim(self): "Test det function with wrong dimensions" print >>sys.stderr, self.typeStr, "... ", @@ -67,6 +75,14 @@ class MatrixTestCase(unittest.TestCase): self.assertEquals(max(matrix), 6) # Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap + def testMaxBadList(self): + "Test max function with bad list" + print >>sys.stderr, self.typeStr, "... ", + max = Matrix.__dict__[self.typeStr + "Max"] + matrix = [[6,"five",4], ["three", 2, "one"]] + self.assertRaises(BadListError, max, matrix) + + # Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap def testMaxNonContainer(self): "Test max function with non-container" print >>sys.stderr, self.typeStr, "... ", @@ -89,6 +105,14 @@ class MatrixTestCase(unittest.TestCase): self.assertEquals(min(matrix), 4) # Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap + def testMinBadList(self): + "Test min function with bad list" + print >>sys.stderr, self.typeStr, "... ", + min = Matrix.__dict__[self.typeStr + "Min"] + matrix = [["nine","eight"], ["seven","six"]] + self.assertRaises(BadListError, min, matrix) + + # Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap def testMinWrongDim(self): "Test min function with wrong dimensions" print >>sys.stderr, self.typeStr, "... ", |