[Python-checkins] cpython (merge 3.4 -> default): Issue #24134: Use assertRaises() in context manager form in test_slice to

serhiy.storchaka python-checkins at python.org
Wed May 20 17:39:06 CEST 2015


https://hg.python.org/cpython/rev/36c4f8af99da
changeset:   96174:36c4f8af99da
parent:      96171:435bc22f39e3
parent:      96173:3a1ee0b5a096
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed May 20 18:38:39 2015 +0300
summary:
  Issue #24134: Use assertRaises() in context manager form in test_slice to
avoid passing the test accidently because slice.__hash__ is None.

files:
  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
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -79,7 +79,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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list