你可以使用 pytest.raises() 作为上下文管理器,来编写一个触发期望异常的断言。 例如,我们有如下测试用例: import pytest def myfunc(): raise ...
確定! 回上一頁