Using debug print routine inside assert
Edvard Majakari
edvard+news at majakari.net
Tue Nov 4 09:13:22 EST 2003
Peter Hansen <peter at engcorp.com> writes:
Hi!
> My solution has been to dispense completely with "debugging code"
> except *during* debugging (when a print or two might appear temporarily,
> or a call to pdb.set_trace()), and instead do all my development using
> unit tests.
Now, if I had to name a person for Father of All Unit Testing Advocates, I
think I knew who'd I name... ;)
> With adequate use of the "unittest" standard module, I haven't encountered
> any reason to call one of those old debug() routines or have a global
> "debug level" variable for eons...
Personally, I think you're right. I've become fascinated with the idea of
unit testing myself, but the problem is that
a) you often have to find out bugs from somebody else's code
b) you've developed system using testing, but the bug didn't appear in
your tests and now you don't know what causes the problem
c) you didn't do unit testing yet when you coded the module or
d) you don't believe in unit testing
to which we'd say d is the wrong answer, c is more likely and a and b just
happen.
--
#!/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