def testIdentity(self): """ The static identity method should return a 3 x 3 identity matrix, unless a different number of rows and columns are specified """ self.assertEqual(Matrix.identity(), self.identity)
def testConstructor(self): """ A new Matrix instance should be a 3 x 3 by default, unless a different number of rows and columns are specified. The matrix should be the zero matrix. """ with self.assertRaises(TypeError): badArguments = Matrix(2.5, 'foo') matrix1 = Matrix() self.assertEqual(matrix1.identity(), self.identity) matrix2 = Matrix(4,2) self.assertEqual(matrix2.rows(), 4) self.assertEqual(matrix2.columns(), 2)