A better unittest
Michael Hudson
mwh at python.net
Thu Apr 17 04:17:14 EDT 2003
Steven Taschuk <staschuk at telusplanet.net> writes:
> Quoth Terry Reedy:
> [...]
> > I like having the actual values too. It should make debugging an
> > unexpected failure easier. But what if each value is more that a few
> > bytes? Example (from my future plans): two lists of all permutations
> > of range(8), one produced by an obvious recursion and the other by a
> > much less obvious iteration.
>
> Now and then I replace
> self.assertEquals(longlist1, longlist2)
> with
> map(self.assertEquals, longlist1, longlist2)
>
> It's not quite ideal; in some cases it would be nice to see the
> index of the mismatch too, for example.
I've used ndiff (or rather difflib) for this.
Cheers,
M.
--
> It might get my attention if you'd spin around in your chair,
> spoke in tongues, and puked jets of green goblin goo.
I can arrange for this. ;-) -- Barry Warsaw & Fred Drake
More information about the Python-list
mailing list