Install
pip install ddt
实例
import unittest
from ddt import ddt, data, unpack@ddt
class MyTestCase(unittest.TestCase):@data((2, 4), (6, 8))# unpack 说明测试用例有多个参数@unpackdef test1(self,value1,value2):self.assertEqual(value2,value1+2)if __name__ == '__main__':unittest.main()