[Python-Dev] PEP: Consolidating names in the `unittest` module
Steven D'Aprano
steve at pearwood.info
Wed Jul 16 02:10:57 CEST 2008
On Wed, 16 Jul 2008 08:13:22 am Guido van Rossum wrote:
> > 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!
I have not knowingly claimed that mechanically swapping fail* to assert*
tests was difficult. The difficulty I refer to is about readability and
understanding of the code. I often think about tests as sequences of
possible failures, and as such my unit tests are most naturally written
as fail*. It is that mental effort of reversing the sense of the tests
when reading and writing assert* tests that I refer to.
If you want to declare that fail* must go, I'll be disappointed but life
will go on. But despite the claims of those who have asserted (pun
intended) that fail* tests are always more difficult to understand,
that's not the case for everyone.
--
Steven
More information about the Python-Dev
mailing list