diff options
author | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2008-06-11 10:11:42 +0200 |
---|---|---|
committer | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2008-06-11 10:11:42 +0200 |
commit | 224d763d8ee7e63f5e9ef225ce9dce1af50dc6ab (patch) | |
tree | 316728d0d817fa5e97db5ce742251a905c52094e | |
parent | 2ee8e730d87f15950194ab6e08ce9f17b34f025b (diff) | |
download | logilab-common-224d763d8ee7e63f5e9ef225ce9dce1af50dc6ab.tar.gz |
Fix an error and add a test case
-rw-r--r-- | test/unittest_testlib.py | 6 | ||||
-rw-r--r-- | testlib.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/test/unittest_testlib.py b/test/unittest_testlib.py index 2349001..3efaae6 100644 --- a/test/unittest_testlib.py +++ b/test/unittest_testlib.py @@ -208,7 +208,11 @@ class TestlibTC(TestCase): tc2 = MyTC('test_1') self.assertEquals(tc2.datadir, expected_datadir) - + def test_is(self): + obj_1 = [] + obj_2 = [] + self.assertIs(obj_1,obj_1) + self.assertRaises(AssertionError, self.assertIs, obj_1, obj_2) class GenerativeTestsTC(TestCase): @@ -1294,7 +1294,9 @@ class TestCase(unittest.TestCase): def assertIs(self, obj, other, msg=None): """compares identity of two reference""" - self.assert_(obj is other, "%r is not %r"%(obj, other), msg) + if msg is None: + msg = "%r is not %r"%(obj, other) + self.assert_(obj is other, msg) def failUnlessRaises(self, excClass, callableObj, *args, **kwargs): """override default failUnlessRaise method to return the raised |