def test_listen(self, llc, ldl, dlc, bind):
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.listen(object(), 0)
assert excinfo.value.errno == errno.ENOTSOCK
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.listen(ldl, 0)
assert excinfo.value.errno == errno.EOPNOTSUPP
with pytest.raises(TypeError) as excinfo:
llc.listen(dlc, 0.1)
assert str(excinfo.value) == "backlog must be int type"
with pytest.raises(ValueError) as excinfo:
llc.listen(dlc, -1)
assert str(excinfo.value) == "backlog can not be negative"
if bind:
llc.bind(dlc)
llc.listen(dlc, 0)
assert dlc.state.LISTEN is True
评论列表
文章目录