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 小时前
批量图片翻译与视频字幕一站式解决高效跨境电商沟通难题
大数据·人工智能·python·音视频
smj2302_796826525 小时前
解决leetcode第3989题网格中保持一致的最大列数
python·算法·leetcode
吴梓穆6 小时前
Python 基础 正则表达式
python
巧克力男孩dd7 小时前
Python超典型练习题(第一次作业)
开发语言·python·算法
闲猫7 小时前
LangChain / Core components / Models
开发语言·python·langchain
cui_ruicheng10 小时前
Python从入门到实战(十三):模块、包与环境管理
开发语言·python
李宸净10 小时前
Web自动化测试selenium+python
前端·python·selenium
而后笑面对10 小时前
生信bwa算法
python
至乐活着12 小时前
深入Python内存管理与垃圾回收:从引用计数到分代回收的实战解析
python·性能优化·内存管理·垃圾回收·引用计数
m0_5474866612 小时前
《Python数据分析与挖掘》全套PPT课件
python·数据挖掘·数据分析