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

最新文章

  1. python mock基本使用
  2. [Linux]CentOS下安装和使用tmux
  3. 串口调试,提示the given port name does not start with COM/com异常解决办法,,发现是打印机在搞怪
  4. Android Studio下载安装使用教程
  5. 利用ASP.NET MVC源代码调试你的应用程序[转]
  6. Hibernate之基于主键映射的一对一关联关系
  7. leetcode面试准备: Game of Life
  8. JavaScript的DOM操作(二)
  9. 【转】HttpServlet详解
  10. canvas 3D雪花效果
  11. SuperSocket基础一
  12. iOS 10 Programming Fundamentals with Swift 学习笔记 0
  13. 禅道导入bugfree 3.0的数据
  14. Minimum Increment to Make Array Unique LT945
  15. Linux 进程一直占用单核CPU分析
  16. Python3多线程之间的执行顺序问题
  17. 基础005_V7-Select IO
  18. C#中的DllImport使用方法
  19. Ad Muncher 目前半价优惠^_^
  20. Vue 3.0 的生命周期

热门文章

  1. leetcode.双指针.680验证回文字符串-Java
  2. Codeforces Paths and Trees
  3. Mac读写NTFS硬盘
  4. 微信小程序学习一 微信小程序的四个基本文件
  5. jsp获取url路径的方法
  6. OpenCV常用基本处理函数(7)图像金字塔和直方图
  7. iSkysoft iMedia Converter Deluxe Mac如何制作视频?视频格式转换工具制作动图的方法
  8. 项目部署错误 HTTP Error 500.19 - Internal Server Error
  9. NVMe SSD是什么?
  10. Reverse array