From: Terry Jan Reedy Date: Mon, 13 Oct 2014 02:00:10 +0000 (-0400) Subject: Change deprecated Exception.message to Exception.args-[0] where the use of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0dc65ef8da3fe2a6543643a5d9d96c7a618cc65;p=python Change deprecated Exception.message to Exception.args-[0] where the use of .message is not an essential part of the test. --- diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 7818112122..6d87eb6957 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -70,7 +70,7 @@ class CommonTest(unittest.TestCase): args = self.fixtype(args) with self.assertRaises(exc) as cm: getattr(obj, methodname)(*args) - self.assertNotEqual(cm.exception.message, '') + self.assertNotEqual(cm.exception.args[0], '') # call object.method(*args) without any checks def checkcall(self, object, methodname, *args): diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index f69255bb33..e786ab6156 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -19,7 +19,7 @@ class StringTest( def checkraises(self, exc, obj, methodname, *args): with self.assertRaises(exc) as cm: getattr(string, methodname)(obj, *args) - self.assertNotEqual(cm.exception.message, '') + self.assertNotEqual(cm.exception.args[0], '') def checkcall(self, object, methodname, *args): getattr(string, methodname)(object, *args) diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py index 9cca14acfd..c18ae54291 100644 --- a/Lib/test/test_userstring.py +++ b/Lib/test/test_userstring.py @@ -33,7 +33,7 @@ class UserStringTest( # we don't fix the arguments, because UserString can't cope with it with self.assertRaises(exc) as cm: getattr(obj, methodname)(*args) - self.assertNotEqual(cm.exception.message, '') + self.assertNotEqual(cm.exception.args[0], '') def checkcall(self, object, methodname, *args): object = self.fixtype(object)