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 obj.__dict__[function] = our_function
# Patch up unittest # Patch up unittest.TestCase
if not hasattr(unittest, 'assertGreater'): if not hasattr(unittest.TestCase, 'assertGreater'):
unittest.assertGreater = lambda self, a, b: self.assertTrue(a > b) unittest.TestCase.assertGreater = lambda self, a, b: self.assertTrue(a > b)
if not hasattr(unittest, 'assertLess'): if not hasattr(unittest.TestCase, 'assertLess'):
unittest.assertLess = lambda self, a, b: self.assertTrue(a < b) unittest.TestCase.assertLess = lambda self, a, b: self.assertTrue(a < b)
class CleanKernelVersionTestCase(unittest.TestCase): class CleanKernelVersionTestCase(unittest.TestCase):

Loading…
Cancel
Save