[Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses

Stephen J. Turnbull stephen at xemacs.org
Wed Mar 19 16:44:20 CET 2008


Michael Urman writes:

 > Yes it removes redundancy, but it really doesn't change the cognitive
 > load (at least for native speakers).

Actually, OONTDI is important to me, cognitively.  Multiple names
implies the possibility of multiple semantics, often unintentionally.
Here that can't be the case by construction, but I wouldn't have known
that if I weren't reading this thread.  And I still won't be sure for
any given one of them, since there are so many remembering the whole
list is "hard."

 > If the blessed set were restricted to assert*, what would users of
 > fail* do when trying to test their packages on py3k? Search and
 > replace, or monkey patch unittest?

So we should add this to 2to3, no?  They're going to run that anyway.

 > I'm guessing monkey patch unittest, which means

I can flag them as people in too much of a hurry to do things right.<wink>

 > the change saves nothing, and costs plenty.

That's a bit short-sighted, no?  It saves nothing for old working
code.  But 90% of the Python code in use 5 years from now will be
written between now and then.


More information about the Python-Dev mailing list