本文整理汇总了Python中snippets.base.tests.ClientMatchRuleFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python ClientMatchRuleFactory.create方法的具体用法?Python ClientMatchRuleFactory.create怎么用?Python ClientMatchRuleFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snippets.base.tests.ClientMatchRuleFactory
的用法示例。
在下文中一共展示了ClientMatchRuleFactory.create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basic
# 需要导入模块: from snippets.base.tests import ClientMatchRuleFactory [as 别名]
# 或者: from snippets.base.tests.ClientMatchRuleFactory import create [as 别名]
def test_basic(self, matches):
rule1_pass = ClientMatchRuleFactory.create()
rule2_pass = ClientMatchRuleFactory.create()
rule3_fail = ClientMatchRuleFactory.create()
rule4_pass = ClientMatchRuleFactory.create()
rule5_fail = ClientMatchRuleFactory.create()
return_values = {
rule1_pass.id: True,
rule2_pass.id: True,
rule3_fail.id: False,
rule4_pass.id: True,
rule5_fail.id: False,
}
matches.side_effect = lambda self, client: return_values.get(self.id, False)
passed, failed = self.manager.all().evaluate('asdf')
eq_(set([rule1_pass, rule2_pass, rule4_pass]), set(passed))
eq_(set([rule3_fail, rule5_fail]), set(failed))