[TIP] A rare philosophical thought
ctrachte at gmail.com
Fri Aug 1 20:58:09 PDT 2008
On 8/1/08, 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.
Hey! I'm just getting started with unittest - can we at least wait
until I learn it and nose starts working with IronPython before it
goes away . . .?
I don't like the way doctest looks - this is so superficial - but
still, Python is supposed to be all about beauty and readability. I
agree that it is a good tool, but can't help feeling it's ugly - the
decimal module had a bunch of code that doctest can use - it just
seems to be too much.
> There. I feel better now.
> Dr. C. Titus Brown, ctb at msu.edu
> Asst Prof., Michigan State U.
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
Maybe it's just my (limited) experience - I have to agree most with
Jesse above - user behavior is insidiously unpredictable. Test the
obvious cases, test the corner cases, test, test test . . .
My 2 cents . . .
More information about the testing-in-python