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('符合条件就跳过')
相关推荐
Ali8852012 分钟前
Python列表增删改查速查表和详细演示
python
新时代牛马23 分钟前
softirq 与tasklet:从irq_exit 到__do_softirq 的下半部路径
python
tqs_1234527 分钟前
值传递与引用传递
java·开发语言·python
YsyaaabB28 分钟前
Deep Agents 实战课程
python·langchain
金銀銅鐵29 分钟前
斐波那契数列中连续10项的和总是能被11整除吗?
python·数学
databook31 分钟前
用 Python 计算联合概率和条件概率
python·数据分析
葡萄成熟时 !1 小时前
泛型知识笔记
开发语言·笔记·python
fengyangaiGEO1 小时前
GEO 如何分析竞品的 AI 引用情况?
人工智能·python·信息可视化
2601_966949652 小时前
实时行情中的成交量 Volume 到底是什么?包含盘中撤单量吗?从交易数据语义到 QuantDash 实战解析
开发语言·人工智能·python·量化·quantdash·量化数据源
you鬰2 小时前
datawhale--llm-algo-leetcode9️⃣ SFT Training Loop
python·datawhale