unittest behaving oddly

Mike Kent mrmakent at cox.net
Tue Jun 20 09:15:06 EDT 2006


David Vincent wrote:

> > import unittest
> >
> > class IntegerArithmenticTestCase(unittest.TestCase):
> >     def testAdd(self):  ## test method names begin 'test*'
> >         assertEquals((1 + 2), 3)
> >         assertEquals(0 + 1, 1)

assertEquals is a member function, inherited from unittest.TestCase, so
you must call it as self.assertEquals.  ForEx:

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




More information about the Python-list mailing list