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 小时前
LangGraph 入门实战(2)
python·langchain
ttod_qzstudio3 小时前
Java 常用语法极简通关(五):类与对象——字段、方法、构造器、this 与 static
java·开发语言·python
jufeng13074 小时前
【系列:手搓自主 AI Agent:Hermes 架构原理剖析 · 第 1 篇】
人工智能·python·架构·agent
月光船幽幽5 小时前
影子模式下保护 logits 不被修改
人工智能·python·算法
_oP_i8 小时前
python 后缀 mjs文件
开发语言·python
北斗落凡尘8 小时前
如何使用LangGraph(1)
python·langchain
Livia要学习9 小时前
Python装饰器
开发语言·python
大模型丫丫10 小时前
LangChain4j:Java 生态的 AI 应用开发利器
java·人工智能·python
circuitsosk10 小时前
向量数据库选型与性能压测:Milvus、Pinecone、Chroma在真实业务下的对比
数据库·python·pinecone·milvus·向量数据库·chroma
雾时之林10 小时前
python--字符串
开发语言·python