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


Python AMQPWriter.write_table方法代码示例

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


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

示例1: test_table_multi

# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_table [as 别名]
    def test_table_multi(self):
        val = {
            'foo': 7,
            'bar': Decimal('123345.1234'),
            'baz': 'this is some random string I typed',
            'ubaz': u'And something in unicode',
            'dday_aniv': datetime(1994, 6, 6),
            'more': {
                'abc': -123,
                'def': 'hello world',
                'now': datetime(2007, 11, 11, 21, 14, 31),
                'qty': Decimal('-123.45'),
                'blank': {},
                'extra': {
                    'deeper': 'more strings',
                    'nums': -12345678,
                },
            }
        }

        w = AMQPWriter()
        w.write_table(val)
        s = w.getvalue()

        r = AMQPReader(s)
        self.assertEqual(r.read_table(), val)
开发者ID:UCSB-CS-RACELab,项目名称:CloudRunner,代码行数:28,代码来源:test_serialization.py

示例2: test_table

# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_table [as 别名]
    def test_table(self):
        val = {'foo': 7}
        w = AMQPWriter()
        w.write_table(val)
        s = w.getvalue()

        self.assertEqualBinary(s, '\x00\x00\x00\x09\x03fooI\x00\x00\x00\x07')

        r = AMQPReader(s)
        self.assertEqual(r.read_table(), val)
开发者ID:UCSB-CS-RACELab,项目名称:CloudRunner,代码行数:12,代码来源:test_serialization.py

示例3: test_table_empty

# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_table [as 别名]
    def test_table_empty(self):
        val = {}
        w = AMQPWriter()
        w.write_table(val)
        s = w.getvalue()

        self.assertEqualBinary(s, '\x00\x00\x00\x00')

        r = AMQPReader(s)
        self.assertEqual(r.read_table(), val)
开发者ID:UCSB-CS-RACELab,项目名称:CloudRunner,代码行数:12,代码来源:test_serialization.py

示例4: test_table_with_array

# 需要导入模块: from amqp.serialization import AMQPWriter [as 别名]
# 或者: from amqp.serialization.AMQPWriter import write_table [as 别名]
    def test_table_with_array(self):
        val = {
            'foo': 7,
            'bar': Decimal('123345.1234'),
            'baz': 'this is some random string I typed',
            'blist': [1,2,3],
            'nlist': [1, [2,3,4]],
            'ndictl': {'nfoo': 8, 'nblist': [5,6,7] }
        }

        w = AMQPWriter()
        w.write_table(val)
        s = w.getvalue()

        r = AMQPReader(s)
        self.assertEqual(r.read_table(), val)
开发者ID:UCSB-CS-RACELab,项目名称:CloudRunner,代码行数:18,代码来源:test_serialization.py


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