diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-01 21:00:13 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-01 21:00:13 (GMT) |
commit | 21782488584f7b633f4a6f125e6ba200c016d644 (patch) | |
tree | 29a4230b83b68b166ff9cffbbd7605071d98e4b3 | |
parent | cca8c53d6aa158d3288ad462c98a1c74b24bc2dd (diff) | |
download | cpython-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.py | 6 |
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): |