Unit-testing single function with large number of different inputs

Edvard Majakari edvard+news at majakari.net
Wed Feb 18 07:11:27 CET 2004

ferrell at diablotech.com (Robert Ferrell) writes:

> add a flag, AllTestsPassed, to the TestLoad and TestValidate classes. 
> Initialize that flag to True.  Then, in your version of assertEqual,
> if any test fails set the flag to False.  Finally, after you've run
> all your tests, add
>   self.failUnless(self.AllTestsPassed, 'Some tests failed.')

But that doesn't give instant feedback (running ValidateTest takes over a
minute), neither does it report exact cause of errors. Hmm. I think I'll
look into Python's ability to create methods on the fly.

Thanks anyway!

PS. Sorry for the provoking .signature, it dates back to the Old Times
when I didn't know of Python ;)

#!/usr/bin/perl -w
69,19,20,6,64,27,61,22,72};$_=join'',map{chr hex $h->{$_}}sort{$a<=>$b}
keys%$h;m/(\w).*\s(\w+)/x;$_.=uc substr(crypt(join('',60,28,14,49),join'',
map{lc}($1,substr $2,4,1)),2,4)."\n"; print;

More information about the Python-list mailing list