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('符合条件就跳过')
相关推荐
老师好,我是刘同学30 分钟前
基数排序原理与Python实现详解
python·排序算法
Storynone9 小时前
【Day20】LeetCode:39. 组合总和,40. 组合总和II,131. 分割回文串
python·算法·leetcode
小鸡吃米…9 小时前
Python—— 环境搭建
python
io_T_T9 小时前
python 文件管理库 Path 解析(详细&基础)
python
渔阳节度使11 小时前
SpringAI实时监控+观测性
后端·python·flask
铁手飞鹰11 小时前
Visual Studio创建Cmake工程导出DLL,通过Python调用DLL
android·python·visual studio
飞Link11 小时前
告别盲目找Bug:深度解析 TSTD 异常检测中的预测模型(Python 实战版)
开发语言·python·算法·bug
7yewh12 小时前
jetson_yolo_deployment 02_linux_dev_skills
linux·python·嵌入式硬件·yolo·嵌入式
love530love13 小时前
ComfyUI rgthree-comfy Image Comparer 节点无输出问题排查与解决
人工智能·windows·python·comfyui·rgthree-comfy·nodes 2.0·vue 节点
badhope13 小时前
Docker从零开始安装配置全攻略
运维·人工智能·vscode·python·docker·容器·github