当前位置: 首页>>代码示例>>Python>>正文


Python TMemoryBuffer.flush方法代码示例

本文整理汇总了Python中thriftpy.transport.TMemoryBuffer.flush方法的典型用法代码示例。如果您正苦于以下问题:Python TMemoryBuffer.flush方法的具体用法?Python TMemoryBuffer.flush怎么用?Python TMemoryBuffer.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thriftpy.transport.TMemoryBuffer的用法示例。


在下文中一共展示了TMemoryBuffer.flush方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_write_i32

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_i32():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.I32, 1234567890)
    b.flush()

    assert "49 96 02 d2" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:9,代码来源:test_protocol_cybinary.py

示例2: test_write_i16

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_i16():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.I16, 12345)
    b.flush()

    assert "30 39" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:9,代码来源:test_protocol_cybinary.py

示例3: test_write_i8

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_i8():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.I08, 123)
    b.flush()

    assert "7b" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:9,代码来源:test_protocol_cybinary.py

示例4: test_write_bool

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_bool():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.BOOL, 1)
    b.flush()

    assert "01" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:9,代码来源:test_protocol_cybinary.py

示例5: test_write_string

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_string():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.STRING, "hello world!")
    b.flush()
    assert "00 00 00 0c 68 65 6c 6c 6f 20 77 6f 72 6c 64 21" == \
        hexlify(b.getvalue())

    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.STRING, u("你好世界"))
    b.flush()
    assert "00 00 00 0c e4 bd a0 e5 a5 bd e4 b8 96 e7 95 8c" == \
        hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:16,代码来源:test_protocol_cybinary.py

示例6: test_write_i64

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_i64():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.I64, 1234567890123456789)
    b.flush()
    assert "11 22 10 f4 7d e9 81 15" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:8,代码来源:test_protocol_cybinary.py

示例7: test_write_double

# 需要导入模块: from thriftpy.transport import TMemoryBuffer [as 别名]
# 或者: from thriftpy.transport.TMemoryBuffer import flush [as 别名]
def test_write_double():
    b = TMemoryBuffer()
    b = TCyBufferedTransport(b)
    proto.write_val(b, TType.DOUBLE, 1234567890.1234567890)
    b.flush()
    assert "41 d2 65 80 b4 87 e6 b7" == hexlify(b.getvalue())
开发者ID:lepture,项目名称:thriftpy,代码行数:8,代码来源:test_protocol_cybinary.py


注:本文中的thriftpy.transport.TMemoryBuffer.flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。