changeset: 96173:3a1ee0b5a096 branch: 3.4 parent: 96169:f10ba5313fbb user: Serhiy Storchaka date: Wed May 20 18:37:37 2015 +0300 files: Lib/test/test_slice.py description: Issue #24134: Use assertRaises() in context manager form in test_slice to avoid passing the test accidently because slice.__hash__ is None. diff -r f10ba5313fbb -r 3a1ee0b5a096 Lib/test/test_slice.py --- a/Lib/test/test_slice.py Wed May 20 16:15:02 2015 +0300 +++ b/Lib/test/test_slice.py Wed May 20 18:37:37 2015 +0300 @@ -80,7 +80,8 @@ 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)