[TIP] new assertion library for unit tests

Michael Gratton michael at quuxo.com
Wed Aug 13 07:19:44 PDT 2008


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.

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

-- 
Michael Gratton <michael at quuxo.com>     
Quuxo Software <http://web.quuxo.com/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20080814/6cad309e/attachment.pgp 


More information about the testing-in-python mailing list