def test_bind_by_addr(self, llc, raw, ldl, dlc):
llc.bind(raw, 16)
assert llc.getsockname(raw) == 16
for i, sock in enumerate([ldl, dlc]):
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(sock, 16)
assert excinfo.value.errno == errno.EACCES
llc.bind(ldl, 63)
assert llc.getsockname(ldl) == 63
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(dlc, 63)
assert excinfo.value.errno == errno.EADDRINUSE
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(dlc, 64)
assert excinfo.value.errno == errno.EFAULT
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.bind(dlc, -1)
assert excinfo.value.errno == errno.EFAULT
llc.bind(dlc, 62)
assert llc.getsockname(dlc) == 62
评论列表
文章目录