我正在尝试从测试错误 __getitem__() 函数并获取 Pylint 针对它的调查结果。
__getitem__()
Pylint
def test_check_error(): with pytest.raises(Exception) as error_i: obj["output"] # getting error for this line assert str(error_i.value) == "abc"
但随着时间的推移 "W0104: Statement seems to have no effect (pointless-statement)"
"W0104: Statement seems to have no effect (pointless-statement)"
你不想使用这个值,所以它对你来说是一个假阳性,你应该禁用这样的消息:
def test_check_error(): with pytest.raises(Exception) as error_i: obj["output"] # pylint: disable=pointless-statement assert str(error_i.value) == "abc"