[TIP] new assertion library for unit tests

Michael Foord fuzzyman at voidspace.org.uk
Wed Aug 13 07:43:15 PDT 2008


Nicolas Chauvat wrote:
> On Wed, Aug 13, 2008 at 03:30:12PM +0100, Michael Foord wrote:
>   
>> 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.
>>     
>
> $ firefox http://www.logilab.org/project/logilab-common
> $ wget http://ftp.logilab.org/pub/common/logilab-common-0.33.0.tar.gz
> $ tar xzf logilab-common-0.33.0.tar.gz
> $ grep 'def assert' logilab/common/testlib.py 
>     def assertDictEquals(self, dict1, dict2):
>     def assertUnorderedIterableEquals(self, got, expected, msg=None):
>     def assertSetEquals(self,got,expected, msg=None):
>     def assertListEquals(self, list_1, list_2, msg=None):
>     def assertLinesEquals(self, list_1, list_2, msg=None):
>     def assertXMLWellFormed(self, stream, msg=None):
>     def assertXMLStringWellFormed(self, xml_string, msg=None):
>     def assertXMLEqualsTuple(self, element, tup):
>     def assertTextEquals(self, text1, text2, junk=None,
>     def assertStreamEquals(self, stream1, stream2, junk=None,
>     def assertFileEquals(self, fname1, fname2, junk=(' ', '\t')):
>     def assertDirEquals(self, path_a, path_b):
>     def assertIsInstance(self, obj, klass, msg=None, strict=False):
>     def assertIs(self, obj, other, msg=None):
>     def assertIsNot(self, obj, other, msg=None):
>     def assertNone(self, obj, msg=None):
>     def assertNotNone(self, obj, msg=None):
> $
>
> Implementation is GPL, but we will happily relicense it in case you
> would like to reuse parts of it for the standard library.
>
> Hope this helps,
>   
Thanks, I have your offer 'on file' until I might need it. :-)

Michael

-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.resolverhacks.net/
http://www.theotherdelia.co.uk/




More information about the testing-in-python mailing list