1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Provide TestCase.assertIsInstance for python < 2.7.

Change-Id: Id6d3c8a7dc56cb560eccc3db897a83c638dec7a6
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jelmer Vernooij 2015-01-28 23:17:13 +01:00 committed by Andrew Bartlett
parent cef4861906
commit fe231bedec

View File

@ -66,6 +66,10 @@ class TestCase(unittest.TestCase):
def assertIsNot(self, a, b):
self.assertTrue(a is not b)
if not getattr(unittest.TestCase, "assertIsInstance", None):
def assertIsInstance(self, a, b):
self.assertTrue(isinstance(a, b))
if not getattr(unittest.TestCase, "addCleanup", None):
def addCleanup(self, fn, *args, **kwargs):
self._cleanups = getattr(self, "_cleanups", []) + [