Thanks to visit codestin.com Credit goes to github.com
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 2dfc168 commit 82cb9a2Copy full SHA for 82cb9a2
1 file changed
Lib/test/test_set.py
@@ -5,6 +5,7 @@
5
import copy
6
import pickle
7
import os
8
+from random import randrange, shuffle
9
10
class PassThru(Exception):
11
pass
@@ -399,6 +400,15 @@ def test_hash(self):
399
400
self.assertEqual(hash(self.thetype('abcdeb')),
401
hash(self.thetype('ebecda')))
402
403
+ # make sure that all permutations give the same hash value
404
+ n = 100
405
+ seq = [randrange(n) for i in xrange(n)]
406
+ results = set()
407
+ for i in xrange(200):
408
+ shuffle(seq)
409
+ results.add(hash(self.thetype(seq)))
410
+ self.assertEqual(len(results), 1)
411
+
412
def test_copy(self):
413
dup = self.s.copy()
414
self.assertEqual(id(self.s), id(dup))
0 commit comments