[英]I have a python file with multiple exception for each block , I need to utest for the same . Is there any approach to cover all exceptions at one go?
要为其编写 utest 的示例 python 文件:
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
try:
code
except Exception as e:
print
我想你正在寻找这个:
try:
foo()
except (SomeException, OtherException, AnotherException) as exp:
...
https://docs.python.org/3/tutorial/errors.html#handling-exceptions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.