@@ -128,7 +128,7 @@ def foo():
128
128
def test_indentation_error (self ) -> None :
129
129
msg = (
130
130
"Couldn't parse '<code>' as Python source: " +
131
- "'unindent does not match any outer indentation level' at line 3"
131
+ "'unindent does not match any outer indentation level.* ' at line 3"
132
132
)
133
133
with pytest .raises (NotPython , match = msg ):
134
134
_ = self .parse_source ("""\
@@ -138,11 +138,17 @@ def test_indentation_error(self) -> None:
138
138
""" )
139
139
140
140
def test_token_error (self ) -> None :
141
- msg = "Couldn't parse '<code>' as Python source: 'EOF in multi-line string' at line 1"
141
+ submsgs = [
142
+ r"EOF in multi-line string" , # before 3.12.0b1
143
+ r"unterminated triple-quoted string literal .detected at line 1." , # after 3.12.0b1
144
+ ]
145
+ msg = (
146
+ r"Couldn't parse '<code>' as Python source: '"
147
+ + r"(" + "|" .join (submsgs ) + ")"
148
+ + r"' at line 1"
149
+ )
142
150
with pytest .raises (NotPython , match = msg ):
143
- _ = self .parse_source ("""\
144
- '''
145
- """ )
151
+ _ = self .parse_source ("'''" )
146
152
147
153
@xfail_pypy38
148
154
def test_decorator_pragmas (self ) -> None :
@@ -254,7 +260,10 @@ def bar(self):
254
260
def test_fuzzed_double_parse (self ) -> None :
255
261
# https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50381
256
262
# The second parse used to raise `TypeError: 'NoneType' object is not iterable`
257
- msg = "EOF in multi-line statement"
263
+ msg = (
264
+ r"(EOF in multi-line statement)" # before 3.12.0b1
265
+ + r"|(unmatched ']')" # after 3.12.0b1
266
+ )
258
267
with pytest .raises (NotPython , match = msg ):
259
268
self .parse_source ("]" )
260
269
with pytest .raises (NotPython , match = msg ):
0 commit comments