当前位置:网站首页>pytest(3)parametrize参数化
pytest(3)parametrize参数化
2022-07-02 06:22:00 【bthtth】
import pytest
datas_list = [("李华",24),("张三",43))
@pytest.mark.parametrize("data",datas_list)
def test_print(data):
print("我是{0},今年{1}岁".format(data[0],data[1]))
parametrize("参数名",组织数据的列表)
# 参数名,用来接受每组需要传递的数据
# 组织数据的列表,不需要加*
# 参数名 要和 用例函数的形参名一样
# 比较ddt,不需要参数名,列表需要加*
@ddt
@data(*datas_list)
def test_print(data)
print("我是{0},今年{1}岁".format(data[0],data[1]))
边栏推荐
猜你喜欢
随机推荐
分布式事务 :可靠消息最终一致性方案
DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positi
【张三学C语言之】—深入理解数据存储
RestTemplate请求时设置请求头,请求参数,请求体。
When requesting resttemplate, set the request header, request parameters, and request body.
压力测试修改解决方案
华为MindSpore开源实习机试题
Hydration failed because the initial UI does not match what was rendered on the server. One of the reasons for the problem
Sentinel 阿里开源流量防护组件
Bgp Routing preference Rules and notice Principles
Decryption skills of encrypted compressed files
LeetCode 283. Move zero
Common means of modeling: combination
VRRP之监视上行链路
automation - Jenkins pipline 执行 nodejs 命令时,提示 node: command not found
BGP报文详细解释
Redis - hot key issues
ROS create workspace
Cglib代理-代码增强测试
ctf-web之练习赛