Exemple #1
0
 def test_long_parse(self):
     # patterns with over 116 parts smash the FilterParser stack (the old parser)
     letters = (c for c in string.ascii_letters * 3)
     fstring = next(letters)
     count = 0
     for c in letters:
         fstring += " AND " + c
         count += 1
     self.assertTrue(count > 130)
     self.assertFalse(matches(fstring, "zzzz"))
     self.assertTrue(matches(fstring, " ".join(string.ascii_letters)))
     # new parser is more robust
     self.assertTrue(make_parse_tree(" OR ".join(map(str, range(2000)))).matches("999"))
     self.assertTrue(make_parse_tree("%s Hi %s" % ("(" * 100, ")" * 100)).matches("hi"))
Exemple #2
0
 def test_long_parse(self):
     # patterns with over 116 parts smash the FilterParser stack (the old parser)
     letters = (c for c in string.ascii_letters * 3)
     fstring = next(letters)
     count = 0
     for c in letters:
         fstring += ' AND ' + c
         count += 1
     self.assertTrue(count > 130)
     self.assertFalse(matches(fstring, 'zzzz'))
     self.assertTrue(matches(fstring, ' '.join(string.ascii_letters)))
     # new parser is more robust
     self.assertTrue(make_parse_tree(' OR '.join(map(str, range(2000)))).matches('999'))
     self.assertTrue(make_parse_tree('%s Hi %s' % ('(' * 100, ')' * 100)).matches('hi'))
Exemple #3
0
 def F(self, filter_string, text):
     self.assertFalse(matches(filter_string, text), msg=(filter_string, text))
Exemple #4
0
 def T(self, filter_string, text):
     self.assertTrue(matches(filter_string, text), msg=(filter_string, text))
Exemple #5
0
 def F(self, filter_string, text):
     self.assertFalse(matches(filter_string, text), msg=(filter_string, text))
Exemple #6
0
 def T(self, filter_string, text):
     self.assertTrue(matches(filter_string, text), msg=(filter_string, text))