Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable.
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 73a77d6..7d11b53 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -1,4 +1,5 @@
import functools
+import collections
import sys
import unittest
from test import support
@@ -446,7 +447,8 @@
return y - x
key = functools.cmp_to_key(mycmp)
k = key(10)
- self.assertRaises(TypeError, hash(k))
+ self.assertRaises(TypeError, hash, k)
+ self.assertFalse(isinstance(k, collections.Hashable))
class TestTotalOrdering(unittest.TestCase):
@@ -660,6 +662,7 @@
TestPythonPartial,
TestUpdateWrapper,
TestTotalOrdering,
+ TestCmpToKey,
TestWraps,
TestReduce,
TestLRU,