[TIP] A rare philosophical thought
brett at python.org
Fri Aug 1 20:55:46 PDT 2008
On Fri, Aug 1, 2008 at 8:10 PM, C. Titus Brown <ctb at msu.edu> wrote:
> 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
> -> ideal.
> 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
> bad idea.
> And let me say,
> I HATE UNITTEST. UNITTEST IS EVIL. UNITTEST NEEDS TO BE REPLACED.
Hallelujah. An overhauled unit testing module really should come about
that is simpler and utilizes more of what Python offers currently
(e.g., context managers).
More information about the testing-in-python