unittest behaving oddly

Fredrik Lundh fredrik at pythonware.com
Tue Jun 20 10:15:36 EDT 2006


David Vincent wrote:

> The code quoted above was from my verbatim copy of the example from the 
> doc strings of unittest.py, from my computer's Python library.  I 
> wonder how the example code could have been so badly wrong?

self-eating viruses on your machine ?

$ more unittest.py

...

Simple usage:

     import unittest

     class IntegerArithmenticTestCase(unittest.TestCase):
         def testAdd(self):  ## test method names begin 'test*'
             self.assertEquals((1 + 2), 3)
             self.assertEquals(0 + 1, 1)
         def testMultiply(self):
             self.assertEquals((0 * 10), 0)
             self.assertEquals((5 * 8), 40)

...

</F>




More information about the Python-list mailing list