A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-July/081029.html below:

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

[Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses [Python-Dev] unittest's redundant assertions: asserts vs. failIf/UnlessesBen Finney bignose+hates-spam at benfinney.id.au
Sun Jul 13 15:34:51 CEST 2008
Antoine Pitrou <solipsis at pitrou.net> writes:

> Ben Finney <bignose+hates-spam <at> benfinney.id.au> writes:
> > That would better be written (preferring PEP 8 names)
> > "fail_unless_equal".
> 
> Which is still a double negative ("fail" and "unless" are both
> negative words).

Hmm, not to this native-English-speaker's ear. "fail" is a verb
stating what will be done, while "unless" and "if" are the conditions
under which it will be done.

> > That's another reason to avoid "assert" in the name: these methods
> > *don't* necessarily use the 'assert' statement.
> 
> But all those constructs (assert, assertEqual, etc.) raise the same
> exception type named AssertionError

Only by default. They can be overridden to raise any exception type.

The only thing they have in common at that point (when the exception
is raised) is that they have failed the test.

-- 
 \       “First things first, but not necessarily in that order.” —The |
  `\                                              Doctor, _Doctor Who_ |
_o__)                                                                  |
Ben Finney

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4