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
$h={23,69,28,'6e',2,64,3,76,7,20,13,61,8,'4d',24,73,10,'6a',12,'6b',21,68,14,
72,16,'2c',17,20,9,61,11,61,25,74,4,61,1,45,29,20,5,72,18,61,15,69,20,43,26,
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