[TIP] A rare philosophical thought
C. Titus Brown
ctb at msu.edu
Fri Aug 1 20:10:27 PDT 2008
On Sat, Aug 02, 2008 at 12:59:29PM +1000, Ben Finney wrote:
-> "Noah Gift" <noah.gift at gmail.com> writes:
-> > What is wrong with a plain assert?
-> Nothing, as far as it goes. The main improvements people usually seem
-> to want over a plain assert is: standard rich failure messages for
-> common assertions, saying what was expected; and the addition of
-> fixtures and other improvements to approach the Don't Repeat Yourself
Aaaaaaand... the real killer is that asserts are disabled in optimized
code, so if you use assert and want to run your tests under
optimization, they will not test anything.
This is actually the one thing about the current assert statement for
which I don't see a simple workaround. Either you have to introduce a
new keyword (hah!) or a new command-line option, which I think is also a
And let me say,
I HATE UNITTEST. UNITTEST IS EVIL. UNITTEST NEEDS TO BE REPLACED.
There. I feel better now.
Dr. C. Titus Brown, ctb at msu.edu
Asst Prof., Michigan State U.
More information about the testing-in-python