A better unittest

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Apr 22 12:42:52 CEST 2003

Thomas Heller <theller at python.net> wrote in news:d6jlf23c.fsf at python.net:

> Would you care to upload your patch to SF, so it doesn't get lost?
Ok, uploaded as patch #725569.

I modified it a bit further before uploading it. There is no longer any 
dependency on an undocumented difflib function, I extracted just the 
relevant code which makes my patch smaller and faster as well as cleaner.
I also timed the code for finding the first difference, and increased the 
slice size to 1000 characters as that seems to provide about the best 
compromise performance both for short and long strings.

> Shouldn't there by a python function which limits the output of
> 'print obj' to *some* amount?

Perhaps an option on pprint? pprint.PrettyPrinter already has arguments 
depth (how far to drill down) and width (the screen width), someone could 
add a height option to try to constrain the output to a certain number of 

Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?

More information about the Python-list mailing list