首页 > 其他 > 详细

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

时间:2021-08-04 16:04:37      阅读:14      评论:0      收藏:0      [点我收藏+]

看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 ...> ...
>>>
"""
装饰器传入的参数的格式是列表类型[(),()]

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

原文:https://www.cnblogs.com/1050619969kong/p/15098310.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!