D84【python 接口自动化学习】- pytest基础用法

day84 pytest常用断言类型

学习日期:20241130

学习目标:pytest基础用法 -- pytest常用断言类型

学习笔记:

常用断言类型
代码实践
python 复制代码
def test_assert():
    assert 1==1
    assert 1!=2
    assert 1<2
    assert 2>1
    assert 1>=1
    assert 1<=1

    assert 'a' in 'abc'
    assert 'a' not in 'bc'
    assert True is True
    assert False is not True
总结
  1. pytest中用assert进行断言,断言类型包括==,!=,<,>,in,not in,<=,>=,is ,is not
相关推荐
Patrick在香港1 小时前
Claude Prompt 香港场景:公文里「今日」落在 6 个日历日上,「翌日」锚错了 5 天
python·自然语言处理·正则表达式·claude·数据清洗
YsyaaabB1 小时前
Python 数值分析
python
阿洛学长1 小时前
计算机二级 Python 基本操作题(15 分)真题笔记(0101 ~ 1903 全套)
python·pycharm
weixin199701080162 小时前
[特殊字符]️《二手ERP对接电商平台的总体方案:统一数据模型 + 事件驱动 + 灰度上线6原则》(附Python源码)
大数据·python
滚雪球~2 小时前
量化交易 防止Windows电脑自动更新并重启
python·量化
L@ncor4 小时前
第二章可能出现的问题
人工智能·python
y = xⁿ4 小时前
大模型基础概念
python
ctlover4 小时前
排序与查找算法详解
开发语言·python
用户8356290780514 小时前
如何使用 Python 给 Word 文档添加水印
后端·python
泡干脆面就番茄4 小时前
深度学习:PyTorch框架初识——MNIST手写数字识别
python·深度学习