标签: junit-theory

Python中的单元测试理论?

在以前的生活中,我做了相当多的Java开发,并发现JUnit Theories非常有用.Python有没有类似的机制?

目前我做的事情如下:

def some_test(self):
    cases = [('some sample input', 'some expected value'),
            ('some other input', 'some other expected value')]

    for value, expected in cases:
        result = method_under_test(value)
        self.assertEqual(expected, result)
Run Code Online (Sandbox Code Playgroud)

但这是相当笨重的,如果第一个"案例"失败,其他所有案件都无法运行.

python unit-testing junit-theory

5
推荐指数
1
解决办法
557
查看次数

标签 统计

junit-theory ×1

python ×1

unit-testing ×1