参数化
@pytest.mark.parametrize("a,b",[(1,2),(5,8),(8,0)]) def test_answer(a,b): assert func(a) == b
另外可以用 元组或者列表
@pytest.mark.parametrize(("a","b"),[(1,2),(5,8),(8,0)]) def test_answer(a,b): assert func(a) == b
@pytest.mark.parametrize(["a","b"],[(1,2),(5,8),(8,0)]) def test_answer(a,b): assert func(a) == b