本文整理汇总了Python中amqp.serialization.AMQPWriter.write_octet方法的典型用法代码示例。如果您正苦于以下问题:Python AMQPWriter.write_octet方法的具体用法?Python AMQPWriter.write_octet怎么用?Python AMQPWriter.write_octet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amqp.serialization.AMQPWriter
的用法示例。
在下文中一共展示了AMQPWriter.write_octet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_octet
# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_octet [as 别名]
def test_octet(self):
for val in range(256):
w = AMQPWriter()
w.write_octet(val)
s = w.getvalue()
self.assertEqualBinary(s, chr(val))
r = AMQPReader(s)
self.assertEqual(r.read_octet(), val)
示例2: test_multiple_bits2
# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_octet [as 别名]
def test_multiple_bits2(self):
"""
Check bits mixed with non-bits
"""
w = AMQPWriter()
w.write_bit(True)
w.write_bit(True)
w.write_bit(False)
w.write_octet(10)
w.write_bit(True)
s = w.getvalue()
self.assertEqualBinary(s, '\x03\x0a\x01')
r = AMQPReader(s)
self.assertEqual(r.read_bit(), True)
self.assertEqual(r.read_bit(), True)
self.assertEqual(r.read_bit(), False)
self.assertEqual(r.read_octet(), 10)
self.assertEqual(r.read_bit(), True)