Numeric array in unittest problem

Peter Hansen peter at engcorp.com
Mon Nov 21 15:47:46 EST 2005


ajikoe at gmail.com wrote:
> Sorry Peter,
> Try this....
> 
> import unittest
> import Numeric
> 
> class myTest(unittest.TestCase):
>     def runTest(self):
>         var1 = Numeric.array([1,22])
>         var2 = Numeric.array([1,33])
>         self.assertEqual(var1,var2)
> 
> if __name__ == '__main__':    
>     unittest.main()

My apologies, as I thought I was pointing out an obvious error, but it 
turns out I was totally wrong about it.

My own use of module unittest has always involved defining methods whose 
names start with "test", as in "def test01(self):" and "def 
test_this(self):" and so forth.

I had no idea that there was a method runTest() that you could override, 
so I was trying to point out that the test case wasn't even executing -- 
though clearly it was!

(Try defining even a single method starting with "test" in addition to 
the runTest() method you have above, and you'll see that runTest() stops 
executing... but obviously this isn't your problem.)

-Peter



More information about the Python-list mailing list