Python基础学习019--跳过

python 复制代码
# 未完成的代码或不想让他执行的代码:使用装饰器跳过,书写在TestCase文件中
# 直接标记跳过:@unittest.skip('跳过原因')

# 根据条件判断跳过:@unittest.skipIf(判断条件,'跳过的原因'),跳进成立则跳过
import unittest

version = 31


class TestDemo(unittest.TestCase):
    @unittest.skip('没有原因,就是不让:')
    def test_1(self):
        print("不用判断就跳过")

    @unittest.skipIf(version >= 20, '20以后得版本不支持此功能')
    def test_2(self):
        print('符合条件就跳过')
相关推荐
吴佳浩3 小时前
大模型量化部署终极指南:让700亿参数的AI跑进你的显卡
人工智能·python·gpu
diegoXie4 小时前
Python / R 向量顺序分割与跨步分割
开发语言·python·r语言
七牛云行业应用5 小时前
解决OSError: No space left... 给DeepSeek Agent装上无限云硬盘
python·架构设计·七牛云·deepseek·agent开发
BoBoZz195 小时前
CutWithScalars根据标量利用vtkContourFilter得到等值线
python·vtk·图形渲染·图形处理
失散135 小时前
Python——1 概述
开发语言·python
萧鼎5 小时前
Python 图像哈希库 imagehash——从原理到实践
开发语言·python·哈希算法
qq_251533595 小时前
使用 Python 提取 MAC 地址
网络·python·macos
Data_agent7 小时前
学术爬虫实战:构建知网论文关键词共现网络的技术指南
python·算法
_一路向北_9 小时前
爬虫框架:Feapder使用心得
爬虫·python
皇族崛起9 小时前
【3D标注】- Unreal Engine 5.7 与 Python 交互基础
python·3d·ue5