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
相关推荐
毋语天1 小时前
FastAPI 进阶实战:请求体、文件上传、响应模型与数据校验
python·fastapi·api开发·数据校验·pydantic
ZhengEnCi2 小时前
09a-斯坦福 CS336 作业一:BPE 分词器
python·神经网络
测试员周周2 小时前
【Appium 系列】第18节-重试与容错 — 移动端测试的稳定性保障
人工智能·python·功能测试·ui·单元测试·appium·测试用例
还是鼠鼠2 小时前
AI掘金头条新闻系统 (Toutiao News)-用户注册-创建用户
后端·python·mysql·fastapi·web
灰灰勇闯IT2 小时前
DeepSeek-R1 在 CANN 上的推理部署
pytorch·python·深度学习
天才测试猿3 小时前
Jenkins+Docker自动化测试全攻略
自动化测试·软件测试·python·测试工具·docker·jenkins·测试用例
5201-4 小时前
向量数据库在 NPU 上的加速
数据库·pytorch·python
arbitrary194 小时前
自动化业务通报系统实现
大数据·数据库·python·jupyter
yuhuofei20214 小时前
【Python入门】Python中字符串相关拓展
android·java·python
weixin199701080164 小时前
[特殊字符] 人工抓取数据革命:从“人肉爬虫”到“智能数据工厂”全面转型指南
开发语言·爬虫·python