@@ -34,7 +34,7 @@ class TestParsers(ParserContext, whitespace="[ ]*"):
34
34
assert TestParsers .hundred .parse (" 100" ) == Success (100 )
35
35
assert TestParsers .hundred .parse ("100 " ) == Success (100 )
36
36
assert TestParsers .hundred .parse (" 100 " ) == Success (100 )
37
- assert str (TestParsers .hundred ) == "hundred = '100'"
37
+ assert str (TestParsers .hundred ) == "hundred = '100' > float "
38
38
39
39
40
40
def test_literal_no_whitespace ():
@@ -48,7 +48,7 @@ class TestParsers(ParserContext):
48
48
assert TestParsers .hundred .parse ("100 " ) == Failure (
49
49
ParseError (StringReader ("100 " , 3 ), ["end of source" ])
50
50
)
51
- assert str (TestParsers .hundred ) == "hundred = '100'"
51
+ assert str (TestParsers .hundred ) == "hundred = '100' > float "
52
52
53
53
54
54
def test_literal_multiple ():
@@ -108,7 +108,7 @@ class TestParsers(ParserContext, whitespace="[ ]*"):
108
108
assert TestParsers .digits .parse (" 100" ) == Success ("100" )
109
109
assert TestParsers .digits .parse ("100 " ) == Success ("100" )
110
110
assert TestParsers .digits .parse (" 100 " ) == Success ("100" )
111
- assert str (TestParsers .digits ) == r"digits = reg(r' \d+')"
111
+ assert str (TestParsers .digits ) == r"digits = reg('\ \d+')"
112
112
113
113
114
114
def test_regex_no_whitespace ():
@@ -122,7 +122,7 @@ class TestParsers(ParserContext):
122
122
assert TestParsers .digits .parse ("100 " ) == Failure (
123
123
ParseError (StringReader ("100 " , 3 ), ["end of source" ])
124
124
)
125
- assert str (TestParsers .digits ) == r"digits = reg(r'\ d+')"
125
+ assert str (TestParsers .digits ) == r"digits = reg('\\ d+') > float "
126
126
127
127
128
128
def test_regex_custom_whitespace ():
@@ -142,7 +142,7 @@ class TestParsers(ParserContext, whitespace="[ ]*"):
142
142
assert TestParsers .pair .parse ("100\n 100" ) == Failure (
143
143
ParseError (StringReader ("100\n 100" , 3 ), [r"r'\d+'" ])
144
144
)
145
- assert str (TestParsers .digits ) == r"digits = reg(r'\ d+')"
145
+ assert str (TestParsers .digits ) == r"digits = reg('\\ d+') > float "
146
146
assert str (TestParsers .pair ) == "pair = digits & digits"
147
147
148
148
@@ -342,6 +342,7 @@ def select_parser(type: str):
342
342
assert NumberParsers .number .parse ("decimal 5" ) == Failure (
343
343
ParseError (StringReader ("decimal 5" , 8 ), [r"r'[0-9]+\.[0-9]+'" ])
344
344
)
345
+ assert str (NumberParsers .number ) == "number = type >= select_parser"
345
346
346
347
347
348
def test_transformation_error_propogation ():
0 commit comments