Exemplo n.º 1
0
async def test_sendAndReceive_no_wakeup(node: Node):
    async def noop(_):
        return False

    node.send = noop
    with pytest.raises(asyncio.TimeoutError):
        await node.sendAndReceive(Basic.Get(), Basic.Report)
Exemplo n.º 2
0
async def test_sendAndReceive(node: Node):
    async def noop(_):
        return True

    node.send = noop
    values = await asyncio.gather(
        node.sendAndReceive(Basic.Get(), Basic.Report),
        runDelayed(node.messageReceived, Basic.Report()),
    )
    assert isinstance(values[0], Basic.Report)