Discussion:
[Python-checkins] cpython (2.7): Change deprecated Exception.message to Exception.args-[0] where the use of
terry.reedy
2014-10-13 02:00:42 UTC
Permalink
https://hg.python.org/cpython/rev/0a70ff9ff510
changeset: 93017:0a70ff9ff510
branch: 2.7
parent: 93009:272c78c9c47e
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Sun Oct 12 22:00:10 2014 -0400
summary:
Change deprecated Exception.message to Exception.args-[0] where the use of
.message is not an essential part of the test.

files:
Lib/test/string_tests.py | 2 +-
Lib/test/test_string.py | 2 +-
Lib/test/test_userstring.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -70,7 +70,7 @@
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
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -19,7 +19,7 @@
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
--- a/Lib/test/test_userstring.py
+++ b/Lib/test/test_userstring.py
@@ -33,7 +33,7 @@
# 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)
--
Repository URL: https://hg.python.org/cpython
Loading...