On 28/06/13 02:32, Jim Mooney wrote:

Hmm, so it seems a lot of trouble for a few hardcoded tests I could
run myself from the IDE interpreter window.

The point is that you should write the doc strings before you write the code. Then anyone can test that your function does at least work for the original design cases. And if you change it you can run that minimum test set very easily and quickly.

the function out myself. I guess there is no easy substitute for
simply beating up your functions with a slew of garbage, since you're
the one who understands them ;')

And that's precisely why the person who writes the code is the worst possible person to test it. If you know how it works you are usually blind sided to it's defects! Ideally all testing should be done by a third party, but in practice it's rarely possible. But it's one of the ideas behind the concept of pair-programming.

But if you want comprehensive testing, regardless of who is doing it, you do need more than doctest. It's a useful sanity check and much better than nothing or even random hacking at the >>> prompt.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to