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(), )
def test_parse_optional(self): re_txt = "a?b" expr = regex.parse(re_txt) self.assertEqual(expr, regex.Symbol("a").optional() + regex.Symbol("b"))
def test_parse_or(self): re_txt = "a|b" expr = regex.parse(re_txt) self.assertEqual(expr, regex.Symbol("a") | regex.Symbol("b"))
def test_parse_epsilon(self): re_txt = "" expr = regex.parse(re_txt) self.assertEqual(expr, regex.EPSILON)
def test_parse(self): re_txt = '[0-9]+' regex.parse(re_txt)