20230523_pytest_作业

数据2101袁冬颖 https://gitee.com/yuandongying/yuandongying.git

数据2101王庆洋

信计2001孙恒丰 test_作业 · 孙恒丰/sunhengfeng - 码云 - 开源中国 (gitee.com) demo_test.py · 孙恒丰/sunhengfeng - 码云 - 开源中国 (gitee.com)

数据2102王文博:5.23.py · 王文博/实习 - Gitee.com

数据2101李明洋

数据2101郭然然:test.课堂练习: pytest以及自动化练习

数据2101江博伦:作业: 12345678910 - Gitee.com

s数据2102-朱垚:test: 作业1111111111111111111

信计2002于爽200350221https://gitee.com/frost-white-on-the-ground/text.git

信计2002侯跃林作业1

信计2002侯跃林 第一次作业
1111111111111111111111111111111

https://gitee.com/xue-dezheng/aa.git 信计2001薛得正

zj: 作业11111111111 数据2102赵晶210620209

数据2101尹广泰:https://gitee.com/warspite0274/practical-training-assignments

信计2002刘冬冬
def add(num1, num2):
“”“计算两个数的和”“”
try:
return round(num1 + num2, 2)
except TypeError:
return ‘参数类型错误’
except ValueError:
return ‘参数数值不合法’
import pytest
import allure

from calculator import add

@pytest.fixture(params=[
[1, 2, 3],
[-1, 0, -1],
[0, 0, 0],
[1.1, 2.2, 3.3],
[-1.1, 2.2, 1.1],
[0.01, 0.02, 0.03],
[-99, 99, 0],
[99, -99, 0],
[0, 99, 99],
[99, 0, 99],
[99, 99, 198],
[699, -600, 99],
[-0.01, 0.01, 0],
[0.01, -0.01, 0],
[0.1, 0.2, 0.3],
[1.23, 4.56, 5.79]
])
def test_data(request):
return request.param

@allure.step(‘计算 {0} + {1} = {2}’)
def test_add(test_data):
num1, num2, expected = test_data
allure.attach(f"被测数据:{test_data}")
with allure.step(‘开始计算’):
assert add(num1, num2) == expected
with allure.step(‘结束计算’):
pass

@pytest.mark.hebeu
def test_add_tag():
pass
pytest -m ‘hebeu’ --alluredir=allure-results

allure serve allure-results

数据2101时坤珅https://gitee.com/shishishi222/

信计2002郭财政https://gitee.com/zhangyh12/xinji-2002-guo-finance.git