We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abaa568 commit a55a54eCopy full SHA for a55a54e
1 file changed
Lib/test/test_dict.py
@@ -1918,6 +1918,20 @@ def test_hash(self):
1918
with self.assertRaisesRegex(TypeError, "unhashable type: 'list'"):
1919
hash(fd)
1920
1921
+ @support.cpython_only
1922
+ def test_hash_cpython(self):
1923
+ # Check that hash(frozendict) implementation is:
1924
+ # hash(frozenset(fd.items()))
1925
+ for fd in (
1926
+ frozendict(),
1927
+ frozendict(x=1, y=2),
1928
+ frozendict(y=2, x=1),
1929
+ frozendict(a=False, b=True, c=True),
1930
+ frozendict.fromkeys('abc'),
1931
+ ):
1932
+ with self.subTest(fd=fd):
1933
+ self.assertEqual(hash(fd), hash(frozenset(fd.items())))
1934
+
1935
def test_fromkeys(self):
1936
self.assertEqual(frozendict.fromkeys('abc'),
1937
frozendict(a=None, b=None, c=None))
0 commit comments