From c2bc1cefdcbbf074408f4a4cace88b315cf9d652 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 9 May 2015 19:13:05 -0400 Subject: [PATCH] Refs #23763 -- Silenced SimpleTestCase.assertRaisesMessage() deprecation warning on Python 3.5. Deprecation warning was introduced in https://bugs.python.org/issue24134 --- django/test/testcases.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/django/test/testcases.py b/django/test/testcases.py index cff2f4411e..86a275e7fd 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -578,8 +578,7 @@ class SimpleTestCase(unittest.TestCase): msg_prefix + "Template '%s' was used unexpectedly in rendering" " the response" % template_name) - def assertRaisesMessage(self, expected_exception, expected_message, - callable_obj=None, *args, **kwargs): + def assertRaisesMessage(self, expected_exception, expected_message, *args, **kwargs): """ Asserts that the message in a raised exception matches the passed value. @@ -587,12 +586,11 @@ class SimpleTestCase(unittest.TestCase): Args: expected_exception: Exception class expected to be raised. expected_message: expected error message string value. - callable_obj: Function to be called. - args: Extra args. + args: Function to be called and extra positional args. kwargs: Extra kwargs. """ 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, field_kwargs=None, empty_value=''):