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


Python Elem.a[1]方法代码示例

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


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

示例1: xtest_direct2

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def xtest_direct2(self):
        doc = Elem()

        doc.a[0] = '000'
        doc.a[1] = '111'

        expected = {'a':['000', '111']}
        out = doc.to_dict()
        self.assertDictEqual(expected, out)
开发者ID:zatosource,项目名称:zato-elem,代码行数:11,代码来源:test_to_dict.py

示例2: test_append_to_list3

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def test_append_to_list3(self):
        doc = Elem()
        doc.a[0] = 0
        doc.a[1] = 1
        doc.a.append(123)

        expected = {"a": [0, 1, 123]}
        out = doc.to_dict()

        self.assertDictEqual(expected, out)
开发者ID:zatosource,项目名称:zato-elem,代码行数:12,代码来源:test_append.py

示例3: xtest_top_level_list_value2

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def xtest_top_level_list_value2(self):
        doc = Elem()

        doc.a[0] = 'a0'
        doc.a[1] = 'a1'

        expected = {'a':['a0', 'a1']}
        out = doc.to_dict()

        self.assertDictEqual(expected, out)
开发者ID:zatosource,项目名称:zato-elem,代码行数:12,代码来源:test_to_dict.py

示例4: xtest_top_level_list_value4

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def xtest_top_level_list_value4(self):
        doc = Elem()

        doc.a[0]
        doc.a[1] = 'a1'
        doc.a[2] = 'a2'

        expected = {'a':[None, 'a1', 'a2']}
        out = doc.to_dict()

        self.assertDictEqual(expected, out)
开发者ID:zatosource,项目名称:zato-elem,代码行数:13,代码来源:test_to_dict.py

示例5: test_on_list_child_idx_error_gt_0

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def test_on_list_child_idx_error_gt_0(self):

        elem = Elem()
        elem.a[0] = 'a0'
        elem.a[1] = 'a1'
        name = 'a'
        out = {'a':['a0', 'a1']}

        ds = DictSerializer()

        try:
            ds.on_list_child(3, name, elem, out)
        except ValueError as e:
            self.assertTrue(e.args[0].startswith('Unexpected input (append), idx:`3`, name:`a`, elem:`<Elem at '))
            self.assertTrue(e.args[0].endswith(">`, out:`{u'a': [u'a0', u'a1']}`" if PY2 else ">`, out:`{'a': ['a0', 'a1']}`"))
开发者ID:zatosource,项目名称:zato-elem,代码行数:17,代码来源:test_serial.py

示例6: test_on_list_child_idx_error_eq_0

# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import a[1] [as 别名]
    def test_on_list_child_idx_error_eq_0(self):

        elem = Elem()
        elem.a[0] = 'a0'
        elem.a[1] = 'a1'
        name = 'a'
        out = {}

        ds = DictSerializer()

        try:
            ds.on_list_child(1, name, elem, out)
        except ValueError as e:
            self.assertTrue(e.args[0].startswith('Unexpected input (first), idx:`1`, name:`a`, elem:`<Elem at '))
            self.assertTrue(e.args[0].endswith('>`, out:`{}`'))
开发者ID:zatosource,项目名称:zato-elem,代码行数:17,代码来源:test_serial.py


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