From: Serhiy Storchaka Date: Wed, 20 May 2015 15:37:37 +0000 (+0300) Subject: Issue #24134: Use assertRaises() in context manager form in test_slice to X-Git-Tag: v2.7.11rc1~302^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3220849524eff6eccde1c19145b245d9fba67b0e;p=thirdparty%2FPython%2Fcpython.git Issue #24134: Use assertRaises() in context manager form in test_slice to avoid passing the test accidently because slice.__hash__ is None. --- diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 3304d6b4e3b9..68518d78f2ab 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -18,7 +18,8 @@ class SliceTest(unittest.TestCase): 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)