测试函数的示例工具
testfunc的Python项目详细描述
简介
一个简单的函数参数化测试工具
示例
fromtestfuncimporttestdeffoo(a=0,b=0):returna+b# test_data is a list of test cases# a test case is the form of (args, result) or (args, kw, result)# if args is a tuple it will be unpacked, if this is not desired, pass `unpack=False` to `test`test_data=[((1,2),3),((1,1),3),((1,),1),((),0),(1,{'b':2},3)]test(foo,test_data)
屏幕截图
查看testfunc.py以获取更多示例。