예제 #1
0
 def testWordBoundryRegex(self):
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.TEXT_HAS,
                             [BUILTIN_ISSUE_FIELDS['label']], ['Type-Bug'],
                             [])
     regex = ast2ast._MakeKeyValueRegex(cond)
     self.assertRegexpMatches('Type-Bug-Security', regex)
     self.assertNotRegexpMatches('Type-BugSecurity', regex)
예제 #2
0
 def testKeyValueRegex(self):
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.KEY_HAS,
                             [BUILTIN_ISSUE_FIELDS['label']],
                             ['Type-Feature', 'Type-Security'], [])
     regex = ast2ast._MakeKeyValueRegex(cond)
     self.assertRegexpMatches('Type-Feature', regex)
     self.assertRegexpMatches('Type-Bug-Security', regex)
     self.assertNotRegexpMatches('Type-Bug', regex)
     self.assertNotRegexpMatches('Security-Feature', regex)
예제 #3
0
 def testKeyValueRegex_multipleKeys(self):
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.KEY_HAS,
                             [BUILTIN_ISSUE_FIELDS['label']],
                             ['Type-Bug', 'Security-Bug'], [])
     with self.assertRaises(ValueError):
         ast2ast._MakeKeyValueRegex(cond)