[Python-Dev] PEP: Consolidating names in the `unittest` module

Guido van Rossum guido at python.org
Wed Jul 16 00:13:22 CEST 2008


On Tue, Jul 15, 2008 at 3:20 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
>  > * Positive admonition: The ``assert*`` names state the intent of how
>  >   the code under test *should* behave, while the ``fail*`` names are
>  >   phrased in terms of how the code *should not* behave.
>
> FWIW, I think these are fairly stated.  So fairly that I'm surprised
> you haven't been persuaded!<wink>  Nitpick: the second point is not
> just "precedent", there's an economic reason there too.  Tests in the
> standard distribution which use the deprecated style will need to be
> converted.  Steven d'Aprano claims this is nontrivial (and thus error-
> prone) in some cases.  I haven't seen that claim denied, and it seems
> plausible to me.

I'd like to see examples of that (this would be Steven's task if he's
serious about his assertion). Since the fail and assert names are
mapped to each other using aliasing I don't see how it could be
nontrivial to map e.g. self.failIf(x) to self.assertFalse(x) -- these
are the same function!

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list