summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-01 21:00:13 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-01 21:00:13 (GMT)
commit21782488584f7b633f4a6f125e6ba200c016d644 (patch)
tree29a4230b83b68b166ff9cffbbd7605071d98e4b3
parentcca8c53d6aa158d3288ad462c98a1c74b24bc2dd (diff)
downloadcpython-21782488584f7b633f4a6f125e6ba200c016d644.zip
cpython-21782488584f7b633f4a6f125e6ba200c016d644.tar.gz
cpython-21782488584f7b633f4a6f125e6ba200c016d644.tar.bz2
Issue #18339: use with self.assertRaises() to make test case more readable
-rw-r--r--Lib/test/test_pickle.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index e96fe52..fbe96ac 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -117,9 +117,11 @@ if has_c_implementation:
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):