def test_write_huge_struct():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(b)
    item = TItem(id=12345, phones=["1234567890"] * 100000)
    b.write_struct(item)
    b.write_message_end()
示例#2
0
def test_write_huge_struct():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(b)
    item = TItem(id=12345, phones=["1234567890"] * 100000)
    b.write_struct(item)
    b.write_message_end()
def test_write_empty_struct():
    b = TMemoryBuffer()
    trans = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(trans)
    item = TItem()
    b.write_struct(item)
    b.write_message_end()
    assert "00" == hexlify(trans.getvalue())
示例#4
0
def test_write_empty_struct():
    b = TMemoryBuffer()
    trans = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(trans)
    item = TItem()
    b.write_struct(item)
    b.write_message_end()
    assert "00" == hexlify(trans.getvalue())
def test_write_struct():
    b = TMemoryBuffer()
    trans = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(trans)
    item = TItem(id=123, phones=["123456", "abcdef"])
    b.write_struct(item)
    b.write_message_end()
    assert ("08 00 01 00 00 00 7b 0f 00 02 0b 00 00 00 02 00 00 00 "
            "06 31 32 33 34 35 36 00 00 00 06 61 62 63 64 65 66 00") == \
        hexlify(trans.getvalue())
示例#6
0
def test_write_struct():
    b = TMemoryBuffer()
    trans = TCyBufferedTransport(b)
    b = proto.TCyBinaryProtocol(trans)
    item = TItem(id=123, phones=["123456", "abcdef"])
    b.write_struct(item)
    b.write_message_end()
    assert ("08 00 01 00 00 00 7b 0f 00 02 0b 00 00 00 02 00 00 00 "
            "06 31 32 33 34 35 36 00 00 00 06 61 62 63 64 65 66 00") == \
        hexlify(trans.getvalue())