本文整理汇总了Python中djblets.conditions.ConditionSet.matches方法的典型用法代码示例。如果您正苦于以下问题:Python ConditionSet.matches方法的具体用法?Python ConditionSet.matches怎么用?Python ConditionSet.matches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类djblets.conditions.ConditionSet
的用法示例。
在下文中一共展示了ConditionSet.matches方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_matches_with_none_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_none_op(self):
"""Testing RepositoriesChoice.matches with "none" operator"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('none')),
])
self.assertTrue(condition_set.matches(repository=None))
self.assertFalse(condition_set.matches(
repository=self.create_repository()))
示例2: test_matches_with_is_private_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_is_private_op(self):
"""Testing RepositoriesChoice.matches with "is-private" operator"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('is-private')),
])
self.assertTrue(condition_set.matches(
repository=self.create_repository(name='repo1', public=False)))
self.assertFalse(condition_set.matches(
repository=self.create_repository(name='repo2', public=True)))
示例3: test_matches_with_any_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_any_op(self):
"""Testing ReviewRequestRepositoriesChoice.matches with "any" operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('any')),
])
self.assertTrue(condition_set.matches(
review_request=self.create_review_request(create_repository=True)))
self.assertFalse(condition_set.matches(
review_request=self.create_review_request()))
示例4: test_matches_with_is_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_is_op(self):
"""Testing ReviewRequestAllDiffFilesChoice.matches with "is" operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('is'), 'file1'),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))
self.filediff2.delete()
self.assertTrue(condition_set.matches(
review_request=self.review_request))
示例5: test_matches_with_none_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_none_op(self):
"""Testing ReviewGroupsChoice.matches with "none" operator"""
self.create_review_group(name='group1')
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('none')),
])
self.assertTrue(condition_set.matches(
review_groups=Group.objects.none()))
self.assertFalse(condition_set.matches(
review_groups=Group.objects.all()))
示例6: test_matches_with_not_one_of_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_not_one_of_op(self):
"""Testing RepositoriesChoice.matches with "not-one-of" operator"""
repository1 = self.create_repository(name='repo1')
repository2 = self.create_repository(name='repo2')
repository3 = self.create_repository(name='repo3')
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('not-one-of'),
[repository1, repository2])
])
self.assertFalse(condition_set.matches(repository=repository1))
self.assertFalse(condition_set.matches(repository=repository2))
self.assertTrue(condition_set.matches(repository=repository3))
示例7: test_matches_with_any_public_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_any_public_op(self):
"""Testing ReviewGroupsChoice.matches with "any-public" operator"""
group1 = self.create_review_group(name='group1', invite_only=False)
group2 = self.create_review_group(name='group2', invite_only=True)
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('any-public')),
])
self.assertTrue(condition_set.matches(
review_groups=Group.objects.filter(pk=group1.pk)))
self.assertFalse(condition_set.matches(
review_groups=Group.objects.filter(pk=group2.pk)))
self.assertFalse(condition_set.matches(
review_groups=Group.objects.none()))
示例8: test_matches_with_not_one_of_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_not_one_of_op(self):
"""Testing ReviewRequestSubmitterChoice.matches with "not-one-of"
operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice,
self.choice.get_operator('not-one-of'),
[self.user1, self.user2]),
])
self.assertFalse(condition_set.matches(
review_request=self.create_review_request(submitter=self.user1)))
self.assertFalse(condition_set.matches(
review_request=self.create_review_request(submitter=self.user2)))
self.assertTrue(condition_set.matches(
review_request=self.create_review_request(submitter=self.user3)))
示例9: test_matches_with_starts_with_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_starts_with_op(self):
"""Testing ReviewRequestAllDiffFilesChoice.matches with "starts-with"
operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('starts-with'),
'file'),
])
self.assertTrue(condition_set.matches(
review_request=self.review_request))
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('starts-with'),
'file1'),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))
示例10: test_matches_with_ends_with_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_ends_with_op(self):
"""Testing ReviewRequestAnyDiffFileChoice.matches with "ends-with"
operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('ends-with'),
'le1'),
])
self.assertTrue(condition_set.matches(
review_request=self.review_request))
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('ends-with'),
'xyz'),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))
示例11: test_matches_with_matches_regex_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_matches_regex_op(self):
"""Testing ReviewRequestAnyDiffFileChoice.matches with "matches-regex"
operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('matches-regex'),
re.compile(r'^[Ff]ile1$')),
])
self.assertTrue(condition_set.matches(
review_request=self.review_request))
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('matches-regex'),
re.compile('^\d')),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))
示例12: test_matches_with_contains_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_contains_op(self):
"""Testing ReviewRequestAnyDiffFileChoice.matches with "contains"
operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('contains'),
'1'),
])
self.assertTrue(condition_set.matches(
review_request=self.review_request))
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('contains'),
'3'),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))
示例13: test_matches_with_contains_any_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_contains_any_op(self):
"""Testing ReviewGroupsChoice.matches with "contains-any" operator"""
group1 = self.create_review_group(name='group1')
group2 = self.create_review_group(name='group2')
group3 = self.create_review_group(name='group3')
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice, self.choice.get_operator('contains-any'),
[group1, group2])
])
self.assertTrue(condition_set.matches(
review_groups=Group.objects.filter(pk=group1.pk)))
self.assertFalse(condition_set.matches(
review_groups=Group.objects.filter(pk=group3.pk)))
self.assertFalse(condition_set.matches(
review_groups=Group.objects.none()))
示例14: test_matches_with_does_not_contain_any_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_does_not_contain_any_op(self):
"""Testing ReviewRequestReviewerChoice.matches with
"does-not-contain-any" operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice,
self.choice.get_operator('does-not-contain-any'),
[self.user1, self.user2]),
])
review_request = self.create_review_request(target_people=[self.user1])
self.assertFalse(condition_set.matches(review_request=review_request))
review_request = self.create_review_request(target_people=[self.user2])
self.assertFalse(condition_set.matches(review_request=review_request))
review_request = self.create_review_request(target_people=[self.user3])
self.assertTrue(condition_set.matches(review_request=review_request))
示例15: test_matches_with_does_not_contain_op
# 需要导入模块: from djblets.conditions import ConditionSet [as 别名]
# 或者: from djblets.conditions.ConditionSet import matches [as 别名]
def test_matches_with_does_not_contain_op(self):
"""Testing ReviewRequestAnyDiffFileChoice.matches with
"does-not-contain" operator
"""
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice,
self.choice.get_operator('does-not-contain'),
'xyz'),
])
self.assertTrue(condition_set.matches(
review_request=self.review_request))
condition_set = ConditionSet(ConditionSet.MODE_ALL, [
Condition(self.choice,
self.choice.get_operator('does-not-contain'),
'file'),
])
self.assertFalse(condition_set.matches(
review_request=self.review_request))