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


Python XPath.and_方法代码示例

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


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

示例1: test_complex

# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import and_ [as 别名]
 def test_complex(self):
     xp = XPath.and_(
         XPath('a').eq('1'),
         XPath('b').neq(XPath.string('')),
         XPath.or_(
             XPath('c').eq(XPath.string('')),
             XPath.date('d').neq('today()')
         ))
     self.assertEqual("a = 1 and b != '' and (c = '' or date(d) != today())", xp)
开发者ID:saketkanth,项目名称:commcare-hq,代码行数:11,代码来源:test_xpath.py

示例2: get_userdata_autoselect

# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import and_ [as 别名]
 def get_userdata_autoselect(key, session_id, mode):
     base_xpath = session_var("data", path="user")
     xpath = session_var(key, path="user/data")
     protected_xpath = XPath.if_(
         XPath.and_(base_xpath.count().eq(1), xpath.count().eq(1)), xpath, XPath.empty_string()
     )
     datum = SessionDatum(id=session_id, function=protected_xpath)
     assertions = [
         EntriesHelper.get_assertion(
             XPath.and_(base_xpath.count().eq(1), xpath.count().eq(1)),
             "case_autoload.{0}.property_missing".format(mode),
             [key],
         ),
         EntriesHelper.get_assertion(
             CaseIDXPath(xpath).case().count().eq(1), "case_autoload.{0}.case_missing".format(mode)
         ),
     ]
     return datum, assertions
开发者ID:johan--,项目名称:commcare-hq,代码行数:20,代码来源:entries.py

示例3: get_if_clause

# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import and_ [as 别名]
 def get_if_clause(case_count_xpath, target_command):
     return_to = session_var(RETURN_TO)
     args = [
         return_to.count().eq(1),
         return_to.eq(XPath.string(target_command)),
     ]
     if case_count_xpath:
         args.append(case_count_xpath)
     return XPath.and_(*args)
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:11,代码来源:workflow.py

示例4: test_and_or

# 需要导入模块: from corehq.apps.app_manager.xpath import XPath [as 别名]
# 或者: from corehq.apps.app_manager.xpath.XPath import and_ [as 别名]
    def test_and_or(self):
        self.assertEqual('a and b and c', XPath.and_('a', 'b', 'c'))
        self.assertEqual('a and (b and c)', XPath.and_('a', XPath.and_('b', 'c')))

        self.assertEqual('a or b or c', XPath.or_('a', 'b', 'c'))
        self.assertEqual('(a or b) or c', XPath.or_(XPath.or_('a', 'b'), XPath('c')))
开发者ID:saketkanth,项目名称:commcare-hq,代码行数:8,代码来源:test_xpath.py


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