gpt4 book ai didi

python - unittest.main() 如何选择测试用例调用的顺序

转载 作者:太空狗 更新时间:2023-10-30 02:49:43 31 4
gpt4 key购买 nike

浪漫测试.py:Dive into Python: Introducing romantest.py

Dive into Python: Test-First Programming -

$ python romantest.py -v

fromRoman should only accept uppercase input ... ERROR
toRoman should always return uppercase ... ERROR
fromRoman should fail with malformed antecedents ... FAIL
fromRoman should fail with repeated pairs of numerals ... FAIL
fromRoman should fail with too many repeated numerals ... FAIL
fromRoman should give known result with known input ... FAIL
toRoman should give known result with known input ... FAIL
fromRoman(toRoman(n))==n for all n ... FAIL
toRoman should fail with non-integer input ... FAIL
toRoman should fail with negative input ... FAIL
toRoman should fail with large input ... FAIL
toRoman should fail with 0 input ... FAIL

[... snipped ...]

我无法理解调用顺序。 unittest.main() 是如何决定的?

最佳答案

根据unittest documentation :

Note that the order in which the various test cases will be run is determined by sorting the test function names with respect to the built-in ordering for strings.

关于python - unittest.main() 如何选择测试用例调用的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6967570/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com