[Pyunit-interest] Help!
Brought to you by:
purcell
From: Peter O. <pc...@co...> - 2006-05-28 22:04:18
|
I am completely befuddled. I run this program ---------- def matrixSize(matrix): return (len(matrix),len(matrix[0])) if __name__ == "__main__": import unittest print "Unit test code." # class MatrixUtilsTest(unittest.TestCase): # def setUp(self): # self.a=[[1,2],[3,4]] # self.b = [[2,4],[6,8]] # self.c = [[3,6],[9,12]] # self.d = [[2,8],[18,32]] # print self.a class MatrixSizeTest(unittest.TestCase): def runTest(self): self.a = [[1,2],[3,4]] self.assertEqual(matrixSize(self.a),(2,2)) # class MatrixSumTest(MatrixUtilsTest): # def testSum(self): # self.failUnless(matrixSum(self.a, self.b) == [[3,6], [9,12]], # "sum incorrect") t = MatrixSizeTest() print t unittest.main() ---------- and get this result ---------- >>> ================================ RESTART ================================ >>> Unit test code. runTest (__main__.MatrixSizeTest) . ---------------------------------------------------------------------- Ran 1 test in 0.024s OK Traceback (most recent call last): File "/Users/pcolsen/D.Sources/Nash_Compact_Numerical_Methods/ testTest.py", line 32, in -toplevel- unittest.main() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/unittest.py", line 759, in __init__ self.runTests() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/unittest.py", line 797, in runTests sys.exit(not result.wasSuccessful()) SystemExit: False >>> ---------- I'm using MacPython 2.4 running on OS-X System Version: Mac OS X 10.4.6 (8I127) Kernel Version: Darwin 8.6.0 |