diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 9203d5eb19ce..1ed71f9575d4 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -80,7 +80,8 @@ def test_repr(self): def test_hash(self): # Verify clearing of SF bug #800796 self.assertRaises(TypeError, hash, slice(5)) - self.assertRaises(TypeError, slice(5).__hash__) + with self.assertRaises(TypeError): + slice(5).__hash__() def test_cmp(self): s1 = slice(1, 2, 3)