class FakeTest(unittest.TestCase):
"""
only purpose is to provide a surrogate for providing global assert methods below
"""
def testNothing(self):
pass
assertMethodStealerTestCaseInstance = FakeTest(methodName='testNothing')
assertEquals = assertEqual = assertMethodStealerTestCaseInstance.assertEqual
assertNotEquals = assertNotEqual =assertMethodStealerTestCaseInstance.assertNotEqual
After typing 'self.assert...' hundreds of times, I can attest that that 10 lines is well worth it - besides the typing, it makes your tests easier to read too!
1 comment:
revised to not use functools at all ... even simpler...
Post a Comment