Fix patching up unittest.TestCase to support assertGreater for ancient Python

master
Mike Gerber 10 years ago
parent 52de7c2da7
commit fb36038bee

@ -18,11 +18,11 @@ def patch_object(obj, function, return_value=None):
obj.__dict__[function] = our_function
# Patch up unittest
if not hasattr(unittest, 'assertGreater'):
unittest.assertGreater = lambda self, a, b: self.assertTrue(a > b)
if not hasattr(unittest, 'assertLess'):
unittest.assertLess = lambda self, a, b: self.assertTrue(a < b)
# Patch up unittest.TestCase
if not hasattr(unittest.TestCase, 'assertGreater'):
unittest.TestCase.assertGreater = lambda self, a, b: self.assertTrue(a > b)
if not hasattr(unittest.TestCase, 'assertLess'):
unittest.TestCase.assertLess = lambda self, a, b: self.assertTrue(a < b)
class CleanKernelVersionTestCase(unittest.TestCase):

Loading…
Cancel
Save