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
相关推荐
ZTLJQ2 小时前
序列化的艺术:Python JSON处理完全解析
开发语言·python·json
H5css�海秀2 小时前
今天是自学大模型的第一天(sanjose)
后端·python·node.js·php
阿贵---2 小时前
使用XGBoost赢得Kaggle比赛
jvm·数据库·python
无敌昊哥战神2 小时前
【LeetCode 257】二叉树的所有路径(回溯法/深度优先遍历)- Python/C/C++详细题解
c语言·c++·python·leetcode·深度优先
李昊哲小课4 小时前
第1章-PySide6 基础认知与环境配置
python·pyqt·pyside
2401_894241925 小时前
用Pygame开发你的第一个小游戏
jvm·数据库·python
Zzzz_my6 小时前
正则表达式(RE)
pytorch·python·正则表达式
天天鸭6 小时前
前端仔写了个 AI Agent,才发现大模型只干了 10% 的活
前端·python·ai编程
setmoon2146 小时前
使用Scikit-learn构建你的第一个机器学习模型
jvm·数据库·python
2401_833197737 小时前
为你的Python脚本添加图形界面(GUI)
jvm·数据库·python