[Tutor] More on unit testing - tests for external data...

Modulok modulok at gmail.com
Fri Dec 11 05:19:36 CET 2009

So, this, 'test environment', this is just like a directory where I
place my code and associated files to test for the existence (and
non-existence) of various stuff, right? Any real-world examples/case
studies to point to?

It seems like there are a lot of people on this list interested in
getting more familiar with unit testing, but not a whole lot of
non-trivial, python-specific examples being passed around. I can write
a function in a programming 101 class that accepts two arguments and
returns a value by computing the hypotenuse of a triangle (or
whatever). I can then build a unit-test for that making sure it fails
and passes as needed. Cake. But jump into the real-world where many
things are not so trivial, and I'm at a loss for where this
unit-testing business all fits in.

Basically, I'm trying to become a better programmer. (Who isn't?) I'd
like to transition from 'hacky but gets the job done' or 'oh my God it
actually works' to 'eloquent and bulletproof'. Without some kind of a
mentor or vast array of tutorials to lay down the law when I screw up,
or pass on some kind of approval when I get something right -  it's
been frustrating as hell.

Case studies/tutorials anyone?


On 12/10/09, spir <denis.spir at free.fr> wrote:
> Wayne Werner <waynejwerner at gmail.com> dixit:
>> On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld
>> <alan.gauld at btinternet.com>wrote:
>> >
>> > Remember, in testing you are not trying to prove it works but rather to
>> > demonstrate that it doesn't!
>> >
>> So in that way it's a bit like the the scientific method (or exactly
>> like)?
>> You create a hypothesis and design tests to invalidate your hypothesis...
>> and if they fail to invalidate you may have a valid hypothesis. Simply
>> replace hypothesis with program and you get the testing procedure?
>> -Wayne
> programming is modelizing -- like a scientist's job
> Denis
> ________________________________
> la vita e estrany
> http://spir.wikidot.com/
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list