On 06/27/2013 09:32 PM, Jim Mooney wrote:
On 27 June 2013 17:05, Dave Angel <da...@davea.name>

Nope.  it is limited to the tests you write.  And those tests are necessarily 
fairly simple.

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

NO. You're completely missing the point. If you don't automate your tests, you'll be neither consistent nor thorough. You want tests that can be run identically three months from now when you're not sure you even remember what that function does. or ten minutes from now when you change some other function that breaks the way this one works.

Or better  yet, I could
code a loop with  some random input, and some extreme cases, and work
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 ;')


The only substitute for "beating up your functions" is hiring someone else to do it for you. They'll catch things you'll miss, simply because they aren't prejudiced by the "knowledge" that "it must be right." But if all they do is interactive testing, then you've still missed the boat.

And you might be amazed what you can accomplish with "simple tests." Most trivial example could be a testing function, whose expected output is either pass or fail. You put a two-line doctest on it, and now your real function gets a real workout. But you can also call things inside a list comprehension, and test that all(mycomp) is True. And so on.

Only when you outgrow doctest do you need a testing harness. And at that point, you might actually understand why you need it.

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

Reply via email to