[TIP] new assertion library for unit tests
Nicolas Chauvat
nicolas.chauvat at logilab.fr
Wed Aug 13 07:41:25 PDT 2008
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,
--
Nicolas Chauvat
logilab.fr - services en informatique scientifique et gestion de connaissances
More information about the testing-in-python
mailing list