diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-20 15:37:37 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-20 15:37:37 (GMT) |
commit | c0e0022f079348f74ad6ecfc40ff8264c0cede74 (patch) | |
tree | 97474a7871a7d34f89b33c0241da2c14b11d403a /Lib/test/test_slice.py | |
parent | ef94869f4fba32cbae214e4763a61e69d0cdad12 (diff) | |
download | cpython-c0e0022f079348f74ad6ecfc40ff8264c0cede74.zip cpython-c0e0022f079348f74ad6ecfc40ff8264c0cede74.tar.gz cpython-c0e0022f079348f74ad6ecfc40ff8264c0cede74.tar.bz2 |
Issue #24134: Use assertRaises() in context manager form in test_slice to
avoid passing the test accidently because slice.__hash__ is None.
Diffstat (limited to 'Lib/test/test_slice.py')
-rw-r--r-- | Lib/test/test_slice.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 9203d5e..1ed71f9 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -80,7 +80,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) |