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

Steve Holden steve at holdenweb.com
Wed Feb 22 01:44:26 EST 2006


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...
> 
A test framework will contain many tests for equality that have nothing 
to do with the tests themselves. So the real answer to this problem is 
to have the tests be more explicit when they need to be. A testEqual(a, 
b) test function would seem to be a more sensible approach than radical 
surgery on the interpreter. The function can then print its arguments if 
they turn out to be unequal.

Otherwise there would have to be some *very* selective mechanism to 
decide when the comparison arguments were printed out.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/



More information about the Python-list mailing list