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


Python FilterConditionService.does_match方法代码示例

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


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

示例1: test_does_match_with_nin_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import does_match [as 别名]
 def test_does_match_with_nin_filter(self):
     f = FilterConditionService()
     doc = {'field': 'urgency', 'operator': 'nin', 'value': '2,3,4'}
     self.assertTrue(f.does_match(doc, self.articles[0]))
     self.assertTrue(f.does_match(doc, self.articles[1]))
     self.assertFalse(f.does_match(doc, self.articles[2]))
     self.assertFalse(f.does_match(doc, self.articles[3]))
     self.assertFalse(f.does_match(doc, self.articles[4]))
     self.assertTrue(f.does_match(doc, self.articles[5]))
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:11,代码来源:filter_condition_tests.py

示例2: test_does_match_with_notlike_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import does_match [as 别名]
 def test_does_match_with_notlike_filter(self):
     f = FilterConditionService()
     doc = {'field': 'headline', 'operator': 'notlike', 'value': 'Que'}
     self.assertTrue(f.does_match(doc, self.articles[0]))
     self.assertFalse(f.does_match(doc, self.articles[1]))
     self.assertTrue(f.does_match(doc, self.articles[2]))
     self.assertTrue(f.does_match(doc, self.articles[3]))
     self.assertTrue(f.does_match(doc, self.articles[4]))
     self.assertTrue(f.does_match(doc, self.articles[5]))
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:11,代码来源:filter_condition_tests.py

示例3: test_does_match_with_in_filter_case_insensitive

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import does_match [as 别名]
 def test_does_match_with_in_filter_case_insensitive(self):
     f = FilterConditionService()
     doc = {'field': 'source', 'operator': 'in', 'value': 'aap,reuters'}
     self.assertTrue(f.does_match(doc, {'source': 'AAP'}))
     self.assertTrue(f.does_match(doc, {'source': 'aap'}))
     self.assertTrue(f.does_match(doc, {'source': 'REUTERS'}))
     doc = {'field': 'source', 'operator': 'in', 'value': 'AAP'}
     self.assertTrue(f.does_match(doc, {'source': 'AAP'}))
     self.assertTrue(f.does_match(doc, {'source': 'aap'}))
     self.assertFalse(f.does_match(doc, {'source': 'REUTERS'}))
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:12,代码来源:filter_condition_tests.py

示例4: test_does_match_with_sms_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import does_match [as 别名]
 def test_does_match_with_sms_filter(self):
     f = FilterConditionService()
     doc = {'field': 'sms', 'operator': 'nin', 'value': 'true'}
     self.assertTrue(f.does_match(doc, self.articles[0]))
     self.assertTrue(f.does_match(doc, self.articles[1]))
     self.assertFalse(f.does_match(doc, self.articles[2]))
     self.assertTrue(f.does_match(doc, self.articles[3]))
     self.assertTrue(f.does_match(doc, self.articles[4]))
     self.assertTrue(f.does_match(doc, self.articles[5]))
     self.assertTrue(f.does_match(doc, self.articles[6]))
     self.assertTrue(f.does_match(doc, self.articles[7]))
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:13,代码来源:filter_condition_tests.py

示例5: test_does_match_with_category_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import does_match [as 别名]
 def test_does_match_with_category_filter(self):
     f = FilterConditionService()
     doc = {'field': 'anpa_category', 'operator': 'in', 'value': 'a,i'}
     self.assertFalse(f.does_match(doc, self.articles[0]))
     self.assertFalse(f.does_match(doc, self.articles[1]))
     self.assertFalse(f.does_match(doc, self.articles[2]))
     self.assertFalse(f.does_match(doc, self.articles[3]))
     self.assertFalse(f.does_match(doc, self.articles[4]))
     self.assertFalse(f.does_match(doc, self.articles[5]))
     self.assertFalse(f.does_match(doc, self.articles[6]))
     self.assertFalse(f.does_match(doc, self.articles[7]))
     self.assertTrue(f.does_match(doc, self.articles[8]))
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:14,代码来源:filter_condition_tests.py


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