本文整理汇总了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)
示例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)
示例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)
示例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)
示例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']}`"))
示例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:`{}`'))