[Solution found!] pytest.raises(Exception) 是您所需要的。 码import pytest def test_passes(): with pytest.raises(Exception) as e_info: x = 1 ...
確定! 回上一頁