本文整理汇总了Python中zato.elem.Elem.ns_map方法的典型用法代码示例。如果您正苦于以下问题:Python Elem.ns_map方法的具体用法?Python Elem.ns_map怎么用?Python Elem.ns_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.elem.Elem
的用法示例。
在下文中一共展示了Elem.ns_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_contains_elem_parent_ns
# 需要导入模块: from zato.elem import Elem [as 别名]
# 或者: from zato.elem.Elem import ns_map [as 别名]
def test_contains_elem_parent_ns(self):
doc = Elem()
doc.ns_map = {'ee':'example.com'}
doc.a.b.ee_c = '123'
# Has NS map
doc2 = Elem()
doc2.ns_map = {'ee':'example.com'}
doc2.zz.qq.ee_c = '456'
doc2.zz.qq.d = '789'
# No NS map yet the prefix is the same
doc3 = Elem()
doc3.zz.qq.ee_c = '456'
doc3.zz.qq.d = '789'
self.assertIn('ee_c', doc.a.b)
self.assertNotIn('c', doc.a.b)
self.assertNotIn('ee_d', doc.a.b)
self.assertIn(doc2.zz.qq.ee_c, doc.a.b)
self.assertNotIn(doc2.zz.qq.ee_d, doc.a.b)
self.assertIn(doc3.zz.qq.ee_c, doc.a.b)
self.assertNotIn(doc3.zz.qq.ee_d, doc.a.b)