[TIP] new assertion library for unit tests

Michael Foord fuzzyman at voidspace.org.uk
Wed Aug 13 07:30:12 PDT 2008

Michael Gratton wrote:
> On Wed, 2008-08-13 at 10:48 +0200, Nicolas Chauvat wrote:
>> With logilab.common.testlib, that's
>> self.assertListEquals(expected, actual)
> Well, that definitely fixes the issues with unittest's assert methods,
> but then the lib needs an assert call for every combination of objects,
> properties and behaviours you might want to test and you need to be able
> remember what they are all called.

I will be making changes to assertEquals so that it has a sensible 
implementation (i.e. useful failure reporting) for lists and other 
containers (and long strings) without requiring a separate method.

Michael Foord
> Does it also have a assertListNotEquals method? I think one of the more
> nifty things about Achoo is that it doesn't need two methods for both
> the cases of an assertion. If you want to test for
> not-something-something, you just put a `is_not.' in front of it, for
> example:
>   requiring(s).equal_to('foo').is_not.equal_to('bar')
> This tests your custom __eq__ and __ne__ methods nicely.
> /Mike
> ------------------------------------------------------------------------
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python


More information about the testing-in-python mailing list