Exemple #1
0
 def test_parse(self):
     re_txt = "[0-9]+"
     expr = regex.parse(re_txt)
     self.assertEqual(
         expr,
         regex.SymbolSet([(48, 57)]) + regex.SymbolSet([(48, 57)]).kleene(),
     )
Exemple #2
0
 def test_parse_optional(self):
     re_txt = "a?b"
     expr = regex.parse(re_txt)
     self.assertEqual(expr,
                      regex.Symbol("a").optional() + regex.Symbol("b"))
Exemple #3
0
 def test_parse_or(self):
     re_txt = "a|b"
     expr = regex.parse(re_txt)
     self.assertEqual(expr, regex.Symbol("a") | regex.Symbol("b"))
Exemple #4
0
 def test_parse_epsilon(self):
     re_txt = ""
     expr = regex.parse(re_txt)
     self.assertEqual(expr, regex.EPSILON)
Exemple #5
0
 def test_parse(self):
     re_txt = '[0-9]+'
     regex.parse(re_txt)