@@ -191,10 +191,12 @@ def test_raises_match(self) -> None:
191
191
int ("asdf" )
192
192
193
193
msg = "with base 16"
194
- expr = "Regex pattern {!r} does not match \" invalid literal for int() with base 10: 'asdf'\" ." .format (
195
- msg
194
+ expr = (
195
+ "Regex pattern did not match.\n "
196
+ f" Regex: { msg !r} \n "
197
+ " Input: \" invalid literal for int() with base 10: 'asdf'\" "
196
198
)
197
- with pytest .raises (AssertionError , match = re .escape (expr )):
199
+ with pytest .raises (AssertionError , match = "(?m)" + re .escape (expr )):
198
200
with pytest .raises (ValueError , match = msg ):
199
201
int ("asdf" , base = 10 )
200
202
@@ -217,7 +219,7 @@ def test_match_failure_string_quoting(self):
217
219
with pytest .raises (AssertionError , match = "'foo" ):
218
220
raise AssertionError ("'bar" )
219
221
(msg ,) = excinfo .value .args
220
- assert msg == 'Regex pattern " \' foo" does not match " \ ' bar". '
222
+ assert msg == ''' Regex pattern did not match. \n Regex: "'foo" \n Input: " 'bar"'' '
221
223
222
224
def test_match_failure_exact_string_message (self ):
223
225
message = "Oh here is a message with (42) numbers in parameters"
@@ -226,9 +228,10 @@ def test_match_failure_exact_string_message(self):
226
228
raise AssertionError (message )
227
229
(msg ,) = excinfo .value .args
228
230
assert msg == (
229
- "Regex pattern 'Oh here is a message with (42) numbers in "
230
- "parameters' does not match 'Oh here is a message with (42) "
231
- "numbers in parameters'. Did you mean to `re.escape()` the regex?"
231
+ "Regex pattern did not match.\n "
232
+ " Regex: 'Oh here is a message with (42) numbers in parameters'\n "
233
+ " Input: 'Oh here is a message with (42) numbers in parameters'\n "
234
+ " Did you mean to `re.escape()` the regex?"
232
235
)
233
236
234
237
def test_raises_match_wrong_type (self ):
0 commit comments