其他分享
首页 > 其他分享> > 参数化模块parameterized执行时装饰器传入数据格式问题

参数化模块parameterized执行时装饰器传入数据格式问题

作者:互联网

看parameterized模块的代码:

@classmethod
def expand(cls, input, name_func=None, doc_func=None, skip_on_empty=False,
**legacy):
""" A "brute force" method of parameterizing test cases. Creates new
test cases and injects them into the namespace that the wrapped
function is being defined in. Useful for parameterizing tests in
subclasses of 'UnitTest', where Nose test generators don't work.

>>> @parameterized.expand([("foo", 1, 2)])
... def test_add1(name, input, expected):
... actual = add1(input)
... assert_equal(actual, expected)
...
>>> locals()
... 'test_add1_foo_0': <function ...> ...
>>>
"""
装饰器传入的参数的格式是列表类型[(),()]

标签:...,add1,parameterized,parameterizing,模块,input,test,数据格式
来源: https://www.cnblogs.com/1050619969kong/p/15098310.html