May i customize basic operator (such as 1==3)?

Thomas Heller theller at python.net
Wed Feb 22 05:35:46 EST 2006


Carl Friedrich Bolz wrote:
> kanchy kang wrote:
>> many people write test cases with python scripts.
>> in these test scripts, there are many validation statements,
>> for example, in unittest, failUnless(a == b),(a/b may be stringType or 
>> intType...)
>>
>> during running test scripts, if there is one exception raised from 
>> failUnless, i still do not know a =?, b= ?... i have to add one statment 
>> "print a" or "print b" again...
>>
>> as i know, there are many validation statements if using python as one 
>> test tool...
>> i think my suggestion or requirement may benefit users greatly...
>>
> 
> you could use the py.test testing framework 
> (http://codespeak.net/py/current/doc/test.html), which tries to print 
> useful information if a test fails.

The standard unittest module can do this also:  replace
calls to failUnless(a == b) with failUnlessEqual(a, b).

Thomas




More information about the Python-list mailing list