本文整理汇总了Python中thriftpy.transport.TMemoryBuffer.write_message_end方法的典型用法代码示例。如果您正苦于以下问题:Python TMemoryBuffer.write_message_end方法的具体用法?Python TMemoryBuffer.write_message_end怎么用?Python TMemoryBuffer.write_message_end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thriftpy.transport.TMemoryBuffer
的用法示例。
在下文中一共展示了TMemoryBuffer.write_message_end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_write_huge_struct
# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import write_message_end [as 别名]
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: test_write_empty_struct
# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import write_message_end [as 别名]
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())
示例3: test_write_message_begin_no_strict
# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import write_message_end [as 别名]
def test_write_message_begin_no_strict():
b = TMemoryBuffer()
trans = TCyBufferedTransport(b)
b = proto.TCyBinaryProtocol(trans, strict_write=False)
b.write_message_begin("test", TType.STRING, 1)
b.write_message_end()
assert "00 00 00 04 74 65 73 74 0b 00 00 00 01" == \
hexlify(trans.getvalue())
示例4: test_write_struct
# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import write_message_end [as 别名]
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())