A better unittest

Thomas Heller theller at python.net
Thu Apr 17 13:47:19 EDT 2003


Thomas Heller <theller at python.net> writes:

> Duncan Booth <duncan at NOSPAMrcp.co.uk> writes:
> 
> > > The difference code could actually be made much faster quite
> > > easily.  If I added a search for the first difference, then I
> > > could do the ellipsis and truncating first and only pass what is
> > > left to difflib.
> > 
> > Old version took 0.18 seconds on Python 2.3, gave up waiting on
> > Python 2.2.  This version takes 0.18 on Python 2.2, 0.08 on Python
> > 2.3.
> 
> Cool! I can now use 10 million character strings, and the test only
> takes 1.5s in 2.2, and 0.7s in CVS python.
> 

I forgot to say, that your patch is even cooler.  Without it,
failUnlessEqual(a, b) tries to print the 10 million character strings
*completely*.

Would you care to upload your patch to SF, so it doesn't get lost?

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

Thomas




More information about the Python-list mailing list