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('符合条件就跳过')
相关推荐
幻影123!8 小时前
从零训练一个会下五子棋的AI
python·深度学习·神经网络·强化学习·五子棋·alpha zero·mokugo
Python私教10 小时前
Django 接入 AI 大模型实战:从零做一个流式聊天网站
人工智能·python·django
Python私教10 小时前
Django 接入 MCP 实战:让 AI 安全调用数据库和业务接口
人工智能·python·django
Python私教10 小时前
Django 搭建 AI 本地知识库:文档上传、向量检索与智能问答
人工智能·python·django
always_TT10 小时前
【Python 日志记录:logging 模块入门】
开发语言·python·php
lipku13 小时前
数字人直播开源项目LiveStream
python·开源·数字人·数字人直播
阿童木写作13 小时前
Python实现亚马逊商品图批量智能抠图教程
人工智能·python
axinawang13 小时前
第24课:while循环的应用
python
三亚兴嘉装饰14 小时前
三亚服装店装修
python
小柯南敲键盘14 小时前
速卖通AI图片翻译API集成实战
人工智能·python