本文整理汇总了Python中spyne.model.complex.Array.__namespace__方法的典型用法代码示例。如果您正苦于以下问题:Python Array.__namespace__方法的具体用法?Python Array.__namespace__怎么用?Python Array.__namespace__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyne.model.complex.Array
的用法示例。
在下文中一共展示了Array.__namespace__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serialize_complex_array
# 需要导入模块: from spyne.model.complex import Array [as 别名]
# 或者: from spyne.model.complex.Array import __namespace__ [as 别名]
def test_serialize_complex_array(self):
days = [
DaysOfWeekEnum.Monday,
DaysOfWeekEnum.Tuesday,
DaysOfWeekEnum.Wednesday,
DaysOfWeekEnum.Thursday,
DaysOfWeekEnum.Friday,
DaysOfWeekEnum.Saturday,
DaysOfWeekEnum.Sunday,
]
days_xml = [
('{tns}DaysOfWeekEnum', 'Monday'),
('{tns}DaysOfWeekEnum', 'Tuesday'),
('{tns}DaysOfWeekEnum', 'Wednesday'),
('{tns}DaysOfWeekEnum', 'Thursday'),
('{tns}DaysOfWeekEnum', 'Friday'),
('{tns}DaysOfWeekEnum', 'Saturday'),
('{tns}DaysOfWeekEnum', 'Sunday'),
]
DaysOfWeekEnumArray = Array(DaysOfWeekEnum)
DaysOfWeekEnumArray.__namespace__ = 'tns'
elt = etree.Element('test')
XmlObject().to_parent_element(DaysOfWeekEnumArray, days,
'test_namespace', elt)
elt = elt[0]
ret = XmlObject().from_element(Array(DaysOfWeekEnum), elt)
assert days == ret
print((etree.tostring(elt, pretty_print=True)))
pprint(self.app.interface.nsmap)
assert days_xml == [ (e.tag, e.text) for e in
elt.xpath('//tns:DaysOfWeekEnum', namespaces=self.app.interface.nsmap)]