diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-01 21:00:22 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-01 21:00:22 (GMT) |
commit | 3126a3d156352167cdbd89bde232842530c9cbbd (patch) | |
tree | 11461b9a5499e91359726e6816f9ff0f829d06eb /Lib | |
parent | 626032ac54ab2d6a779e10fdfd6eea06e43cbcc7 (diff) | |
parent | 21782488584f7b633f4a6f125e6ba200c016d644 (diff) | |
download | cpython-3126a3d156352167cdbd89bde232842530c9cbbd.zip cpython-3126a3d156352167cdbd89bde232842530c9cbbd.tar.gz cpython-3126a3d156352167cdbd89bde232842530c9cbbd.tar.bz2 |
Issue #18339: use with self.assertRaises() to make test case more readable
Diffstat (limited to 'Lib')
-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): |