summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index f98048b..1f659d7 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1801,6 +1801,18 @@ class TestCollectionABCs(ABCTestCase):
self.assertTrue(f1 != l1)
self.assertTrue(f1 != l2)
+ def test_Set_hash_matches_frozenset(self):
+ sets = [
+ {}, {1}, {None}, {-1}, {0.0}, {"abc"}, {1, 2, 3},
+ {10**100, 10**101}, {"a", "b", "ab", ""}, {False, True},
+ {object(), object(), object()}, {float("nan")}, {frozenset()},
+ {*range(1000)}, {*range(1000)} - {100, 200, 300},
+ {*range(sys.maxsize - 10, sys.maxsize + 10)},
+ ]
+ for s in sets:
+ fs = frozenset(s)
+ self.assertEqual(hash(fs), Set._hash(fs), msg=s)
+
def test_Mapping(self):
for sample in [dict]:
self.assertIsInstance(sample(), Mapping)