unittest behaving oddly

David Vincent d__ at mac.com
Tue Jun 20 10:02:21 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----

On 20/06/2006, at 23:15, Mike Kent wrote:

> 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:

(Details deleted)


Thank you Mike.  That fixes most of my problems.

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?


regards

David

- -- 

David A Vincent                          dvincent at toshiba-tap.com
Software Engineer                       telephone +61 2 9850-2593
RESEARCH AND DEVELOPMENT         TOSHIBA (AUSTRALIA) PTY. LIMITED
"The situation is hopeless, we must take the next step." P.Casals

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iQCVAwUBRJf/7pjExRNGDpoZAQEaKgQAgCVSdE/WJCunEdPfEIgCHk+dKMJHc2B6
XWfc3WPvUcH5RL4dQ18bbKNHEoHSZbMrN4CLKD55LueeaPbIgFgOpSkwoRRoakDi
LWNbn7OWz2G1mbNgEVvqkOBhfK5l582kjzndtdsPBPD+Pv/KiEC77/6dN27Fnl6e
d0oKoDD3aac=
=/dqt
-----END PGP SIGNATURE-----




More information about the Python-list mailing list