pytest---参数化
2024-10-07 17:05:47
import pytest @pytest.mark.parametrize('test_input,expected',[('3+5',8),
('2-1',1),('7*5',30)])
def test_eval(test_input,expected):
assert eval(test_input)==expected ----eval把字符串转换成表达式
est_param.py::test_eval[2-1-1]
test_param.py::test_eval[7*5-30] PASSED [ 33%]PASSED [ 66%]FAILED [100%]
test_param.py:3 (test_eval[7*5-30])
35 != 30
Expected :30
Actual :35
<Click to see difference>
test_input = '7*5', expected = 30
@pytest.mark.parametrize('test_input,expected',[('3+5',8),
('2-1',1),('7*5',30)])
def test_eval(test_input,expected):
> assert eval(test_input)==expected
E assert 35 == 30 ----提示把30改成35
test_param.py:7: AssertionError
Assertion failed
最新文章
- python mock基本使用
- [Linux]CentOS下安装和使用tmux
- 串口调试,提示the given port name does not start with COM/com异常解决办法,,发现是打印机在搞怪
- Android Studio下载安装使用教程
- 利用ASP.NET MVC源代码调试你的应用程序[转]
- Hibernate之基于主键映射的一对一关联关系
- leetcode面试准备: Game of Life
- JavaScript的DOM操作(二)
- 【转】HttpServlet详解
- canvas 3D雪花效果
- SuperSocket基础一
- iOS 10 Programming Fundamentals with Swift 学习笔记 0
- 禅道导入bugfree 3.0的数据
- Minimum Increment to Make Array Unique LT945
- Linux 进程一直占用单核CPU分析
- Python3多线程之间的执行顺序问题
- 基础005_V7-Select IO
- C#中的DllImport使用方法
- Ad Muncher 目前半价优惠^_^
- Vue 3.0 的生命周期