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


Python Elem.ns_map方法代码示例

本文整理汇总了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)
开发者ID:zatosource,项目名称:zato-elem,代码行数:27,代码来源:test_contains.py


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