Ada*_*kin 5 python unit-testing junit-theory
在以前的生活中,我做了相当多的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)
但这是相当笨重的,如果第一个"案例"失败,其他所有案件都无法运行.
| 归档时间: |
|
| 查看次数: |
557 次 |
| 最近记录: |