class MethodTest(TestCase):

    def test_method(self):
        obj = MyClass()
for method in ('frob', 'defrob', 'refrob'):
    self.assertEqual(getattr(obj, method)(), 42, 
        'obj.%s() is not equal to 42' % method)
How to get parameters of fail case in Python unittest?