summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_slice.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-09-05 14:27:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-09-05 14:27:30 (GMT)
commitb859c070efbf3c6fd5210c0ae0e4d5a3de4bf9b2 (patch)
tree9f22bd1f76d59c4187760134b55237dc46accdc8 /Lib/test/test_slice.py
parenta1a1dba2d48a92ccd49fe7529bd5a02b5ada1cb2 (diff)
downloadcpython-b859c070efbf3c6fd5210c0ae0e4d5a3de4bf9b2.zip
cpython-b859c070efbf3c6fd5210c0ae0e4d5a3de4bf9b2.tar.gz
cpython-b859c070efbf3c6fd5210c0ae0e4d5a3de4bf9b2.tar.bz2
SF bug #800796: Difference between hash() and __hash__()
slice(5).__hash__() now raises a TypeError.
Diffstat (limited to 'Lib/test/test_slice.py')
-rw-r--r--Lib/test/test_slice.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index d216c30..d8eb882 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -14,6 +14,11 @@ class SliceTest(unittest.TestCase):
def test_repr(self):
self.assertEqual(repr(slice(1, 2, 3)), "slice(1, 2, 3)")
+ def test_hash(self):
+ # Verify clearing of SF bug #800796
+ self.assertRaises(TypeError, hash, slice(5))
+ self.assertRaises(TypeError, slice(5).__hash__)
+
def test_cmp(self):
s1 = slice(1, 2, 3)
s2 = slice(1, 2, 3)