[Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses (original) (raw)
Ben Finney bignose+hates-spam at benfinney.id.au
Sun Jul 13 15:34:51 CEST 2008
- Previous message: [Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses
- Next message: [Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Antoine Pitrou <solipsis at pitrou.net> writes:
Ben Finney <bignose+hates-spam benfinney.id.au> writes: > That would better be written (preferring PEP 8 names) > "failunlessequal".
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
- Previous message: [Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses
- Next message: [Python-Dev] unittest's redundant assertions: asserts vs. failIf/Unlesses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]