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('符合条件就跳过')
相关推荐
workflower6 小时前
时序数据获取事件
开发语言·人工智能·python·深度学习·机器学习·结对编程
C++业余爱好者7 小时前
Java 提供了8种基本数据类型及封装类型介绍
java·开发语言·python
AI Echoes8 小时前
构建一个LangChain RAG应用
数据库·python·langchain·prompt·agent
派大鑫wink8 小时前
从零到精通:Python 系统学习指南(附实战与资源)
开发语言·python
c骑着乌龟追兔子8 小时前
Day 38 官方文档的阅读
python
羸弱的穷酸书生9 小时前
国网 i1协议 python实现
开发语言·python
weixin_462022359 小时前
RAW-Adapter: Adapting Pre-trained Visual Model to Camera RAW Images
python·计算机视觉
电子硬件笔记9 小时前
Python语言编程导论第三章 编写程序
开发语言·python·编辑器
布谷歌9 小时前
在java中实现c#的int.TryParse方法
java·开发语言·python·c#