Exemple #1
0
async def test_pack_unpack(protocol, reader):
    message = {
        "Some": "crazy",
        "Message": ["message", 10],
        "with": 1000
    }
    reader.feed_data(QDataStreamProtocol.pack_message(json.dumps(message)))

    assert message == await protocol.read_message()
async def test_types():
    with pytest.raises(NotImplementedError):
        QDataStreamProtocol.pack_message({"Not": ["a", "string"]})
async def test_QDataStreamProtocol_pack_unpack(protocol, reader, message):
    reader.feed_data(QDataStreamProtocol.pack_message(json.dumps(message)))

    assert message == await protocol.read_message()