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/081031.html below:

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

[Python-Dev] unittest's redundant assertions: asserts vs. failIf/UnlessesAntoine Pitrou solipsis at pitrou.net
Sun Jul 13 16:39:48 CEST 2008
Let's split hairs a little...

Steve Holden <steve <at> holdenweb.com> writes:
> "Fail" isn't a negative. As Guido said, it's a description of the test 
> behavior under particular circumstances.

In most circumstances, "fail" is a negative word defined as the contrary of
something else (that is, as the "failure to pass/succeed/perform/achieve/..."),
while the reverse is not true (few people would define "success" or "passing a
test" as the negative of "failure", except in desperate circumstances). Although
I'm not a native English speaker, I don't think our respective languages and
cultures differ on this point.


> "fail_unless_equal" says quite 
> clearly that the test requires equality of the values.

Actually, saying "that the test requires equality of the values" translates
directly into an "assert equals" (or "enforce equals" if you want a stronger
word) rather than a "fail if not equal". It is a grammatical fact...

In other words, if you express a requirement, you intent to say how the
implementation under test is supposed to behave for it to be considered
successful, not the conditions under which its behaviour constitutes a failure. 

As you said, if an exception is thrown which isn't part of the testing protocol
(e.g. something other than an AssertionError), the test is still said to fail...
if the intent of testing were to test for failure conditions, on the contrary,
the test would be said to be passed (because it wouldn't have met the failure
conditions).

Regards

Antoine.


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