Refs #23763 -- Silenced SimpleTestCase.assertRaisesMessage() deprecation warning on Python 3.5.

Deprecation warning was introduced in https://bugs.python.org/issue24134
This commit is contained in:
Tim Graham 2015-05-09 19:13:05 -04:00
parent 70e3e2e08e
commit c2bc1cefdc
1 changed files with 3 additions and 5 deletions

View File

@ -578,8 +578,7 @@ class SimpleTestCase(unittest.TestCase):
msg_prefix + "Template '%s' was used unexpectedly in rendering" msg_prefix + "Template '%s' was used unexpectedly in rendering"
" the response" % template_name) " the response" % template_name)
def assertRaisesMessage(self, expected_exception, expected_message, def assertRaisesMessage(self, expected_exception, expected_message, *args, **kwargs):
callable_obj=None, *args, **kwargs):
""" """
Asserts that the message in a raised exception matches the passed Asserts that the message in a raised exception matches the passed
value. value.
@ -587,12 +586,11 @@ class SimpleTestCase(unittest.TestCase):
Args: Args:
expected_exception: Exception class expected to be raised. expected_exception: Exception class expected to be raised.
expected_message: expected error message string value. expected_message: expected error message string value.
callable_obj: Function to be called. args: Function to be called and extra positional args.
args: Extra args.
kwargs: Extra kwargs. kwargs: Extra kwargs.
""" """
return six.assertRaisesRegex(self, expected_exception, return six.assertRaisesRegex(self, expected_exception,
re.escape(expected_message), callable_obj, *args, **kwargs) re.escape(expected_message), *args, **kwargs)
def assertFieldOutput(self, fieldclass, valid, invalid, field_args=None, def assertFieldOutput(self, fieldclass, valid, invalid, field_args=None,
field_kwargs=None, empty_value=''): field_kwargs=None, empty_value=''):