def test_send(self, tco, pdu): assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None assert tco.dequeue(1, 0, False) is None assert tco.dequeue(10, 4, False) == pdu assert tco.dequeue(10, 4) is None threading.Timer(0.01, tco.dequeue, (10, 4)).start() tco.send(pdu, 0)
def test_send(self, tco): pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122')) assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is True assert tco.dequeue(10, 4) == pdu threading.Timer(0.01, tco.dequeue, (10, 4)).start() assert tco.send(pdu, 0) is True tco.close() with pytest.raises(nfc.llcp.Error) as excinfo: tco.send(pdu, 0) assert excinfo.value.errno == errno.ESHUTDOWN
def test_poll(self, tco): pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122')) assert tco.poll("", 1.0) is None assert tco.poll("recv", 0.001) is None assert tco.enqueue(pdu) is True assert tco.poll("recv", 0.001) == pdu assert tco.poll("send", 1.0) is True assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None assert tco.poll("send", 0.001) is False assert tco.dequeue(10, 4, False) == pdu assert tco.poll("send", 1.0) is True
def test_send_with_error_not_connected(self, tco): with pytest.raises(nfc.llcp.Error) as excinfo: tco.send(b'', nfc.llcp.MSG_DONTWAIT) assert excinfo.value.errno == errno.ENOTCONN