本文整理汇总了Python中osc2.util.xpath.XPathBuilder.dummy方法的典型用法代码示例。如果您正苦于以下问题:Python XPathBuilder.dummy方法的具体用法?Python XPathBuilder.dummy怎么用?Python XPathBuilder.dummy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osc2.util.xpath.XPathBuilder
的用法示例。
在下文中一共展示了XPathBuilder.dummy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dummy5
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy5(self):
"""test DummyExpression on the right hand side of "and" op"""
xpb = XPathBuilder()
xp = xpb.dummy()
xp = xpb.foo & xp
exp = '/foo'
self.assertEqual(xp.tostring(), exp)
示例2: test_dummy6
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy6(self):
"""test DummyExpression on the right hand side of "or" op"""
xpb = XPathBuilder()
xp = xpb.dummy()
xp = xpb.bar | xp
exp = '/bar'
self.assertEqual(xp.tostring(), exp)
示例3: _find_requests
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def _find_requests(cls, tgt_project, tgt_package, info):
"""Returns a collection of requests."""
xpb = XPathBuilder(is_relative=True)
xp = xpb.dummy()
by_kind, xp = cls._build_by_predicate(xpb, info, info.state)
if not by_kind:
xp = cls._add_states(xpb, xpb.dummy(), info.state)
xp = (xpb.state.attr('name') == 'review') & xp.parenthesize()
if tgt_project is not None:
xp = xp & (xpb.action.target.attr('project') == tgt_project)
if tgt_package is not None:
xp = xp & (xpb.action.target.attr('package') == tgt_package)
logger().debug(xp.tostring())
res = find_request(xp=xp, apiurl=info.apiurl)
collection = [r for r in res]
return collection
示例4: test_dummy2
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy2(self):
"""test dummy method 2"""
xpb = XPathBuilder()
xp = xpb.dummy()
self.assertFalse(xp)
xp = xp & (xpb.attr('foo') == 'xyz')
self.assertTrue(xp)
exp = '@foo = "xyz"'
self.assertEqual(xp.tostring(), exp)
示例5: test_dummy1
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy1(self):
"""test dummy method 1"""
xpb = XPathBuilder()
xp = xpb.dummy()
self.assertFalse(xp)
xp = xp & xpb.foo.bar
self.assertTrue(xp)
exp = '/foo/bar'
self.assertEqual(xp.tostring(), exp)
示例6: _find_requests
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def _find_requests(cls, project, package, info):
"""Returns a collection of requests."""
xpb = XPathBuilder(is_relative=True)
xp = xpb.dummy()
# state has at least one element
for state in info.state:
xp = xp | xpb.state.attr('name') == state
xp = xp.parenthesize()
if info.user is not None:
xp = xp & ((xpb.state.attr('who') == info.user)
| (xpb.history.attr('who') == info.user)).parenthesize()
if project is not None:
tmp = ((xpb.action.target.attr('project') == project)
| (xpb.action.source.attr('project') == project))
xp = xp & tmp.parenthesize()
if package is not None:
tmp = ((xpb.action.target.attr('package') == package)
| (xpb.action.source.attr('package') == package))
xp = xp & tmp.parenthesize()
logger().debug(xp.tostring())
res = find_request(xp=xp, apiurl=info.apiurl)
collection = [r for r in res]
return collection
示例7: test_dummy4
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy4(self):
"""test DummyExpression negate (log_not)"""
xpb = XPathBuilder()
xp = xpb.dummy()
self.assertTrue(xp.log_not() is xp)
示例8: test_dummy3
# 需要导入模块: from osc2.util.xpath import XPathBuilder [as 别名]
# 或者: from osc2.util.xpath.XPathBuilder import dummy [as 别名]
def test_dummy3(self):
"""test DummyExpression's parenthesize method"""
xpb = XPathBuilder()
xp = xpb.dummy()
self.assertTrue(xp.parenthesize() is xp)