@@ -191,10 +191,12 @@ def test_raises_match(self) -> None:
191191 int ("asdf" )
192192
193193 msg = "with base 16"
194- expr = "Regex pattern {!r} does not match \" invalid literal for int() with base 10: 'asdf'\" ." .format (
195- msg
196- )
197- with pytest .raises (AssertionError , match = re .escape (expr )):
194+ expr = (
195+ "Regex pattern did not match.\n "
196+ " Regex: {!r}\n "
197+ " Input: \" invalid literal for int() with base 10: 'asdf'\" "
198+ ).format (msg )
199+ with pytest .raises (AssertionError , match = "(?m)" + re .escape (expr )):
198200 with pytest .raises (ValueError , match = msg ):
199201 int ("asdf" , base = 10 )
200202
@@ -217,7 +219,7 @@ def test_match_failure_string_quoting(self):
217219 with pytest .raises (AssertionError , match = "'foo" ):
218220 raise AssertionError ("'bar" )
219221 (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"'' '
221223
222224 def test_match_failure_exact_string_message (self ):
223225 message = "Oh here is a message with (42) numbers in parameters"
@@ -226,9 +228,10 @@ def test_match_failure_exact_string_message(self):
226228 raise AssertionError (message )
227229 (msg ,) = excinfo .value .args
228230 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?"
232235 )
233236
234237 def test_raises_match_wrong_type (self ):
0 commit comments