[Python-checkins] cpython (3.3): Issue #18339: use with self.assertRaises() to make test case more readable

christian.heimes python-checkins at python.org
Mon Jul 1 23:00:33 CEST 2013


http://hg.python.org/cpython/rev/fa0a03afe359
changeset:   84416:fa0a03afe359
branch:      3.3
parent:      84414:3ec5267f51ff
user:        Christian Heimes <christian at cheimes.de>
date:        Mon Jul 01 23:00:13 2013 +0200
summary:
  Issue #18339: use with self.assertRaises() to make test case more readable

files:
  Lib/test/test_pickle.py |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -117,9 +117,11 @@
 
         def test_issue18339(self):
             unpickler = self.unpickler_class(io.BytesIO())
-            self.assertRaises(TypeError, setattr, unpickler, "memo", object)
+            with self.assertRaises(TypeError):
+                unpickler.memo = object
             # used to cause a segfault
-            self.assertRaises(ValueError, setattr, unpickler, "memo", {-1: None})
+            with self.assertRaises(ValueError):
+                unpickler.memo = {-1: None}
             unpickler.memo = {1: None}
 
     class CDispatchTableTests(AbstractDispatchTableTests):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list