参数化模块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 ...> ...
>>>
"""
装饰器传入的参数的格式是列表类型[(),()]
posted @ 2021-08-04 12:11  GalaxyStar  阅读(147)  评论(0编辑  收藏  举报