summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_slice.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-20 15:37:37 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-20 15:37:37 (GMT)
commit3220849524eff6eccde1c19145b245d9fba67b0e (patch)
tree869468a337f7f74bc463e8a73aa960517cd1ac05 /Lib/test/test_slice.py
parentbc5046634af21893627e1c11deba14552da44ba8 (diff)
downloadcpython-3220849524eff6eccde1c19145b245d9fba67b0e.zip
cpython-3220849524eff6eccde1c19145b245d9fba67b0e.tar.gz
cpython-3220849524eff6eccde1c19145b245d9fba67b0e.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.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index 3304d6b..68518d7 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)