From fe231bedecace7e97da22add0cf48f1fd3772544 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 28 Jan 2015 23:17:13 +0100 Subject: Provide TestCase.assertIsInstance for python < 2.7. Change-Id: Id6d3c8a7dc56cb560eccc3db897a83c638dec7a6 Signed-off-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett --- python/samba/tests/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 65a727aaf6..480b2c8135 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -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", []) + [ -- cgit