class TestSequence(unittest.TestCase):
    pass
if __name__ == '__main__':
    for i in range(1, 11):
        testmethodname = 'test_fn_{0}'.format(i)
testmethod = lambda self: self.assertEqual(fn(i), output[i])
setattr(TestSequence, testmethodname, testmethod)
unittest.main()
How do I run multiple Python test cases in a loop?