The pytest.raises function has a clearer error message when match matches the obtained string but is not regex-escaped.