import copy
import pickle
import os
+from random import randrange, shuffle
class PassThru(Exception):
pass
self.assertEqual(hash(self.thetype('abcdeb')),
hash(self.thetype('ebecda')))
+ # make sure that all permutations give the same hash value
+ n = 100
+ seq = [randrange(n) for i in xrange(n)]
+ results = set()
+ for i in xrange(200):
+ shuffle(seq)
+ results.add(hash(self.thetype(seq)))
+ self.assertEqual(len(results), 1)
+
def test_copy(self):
dup = self.s.copy()
self.assertEqual(id(self.s), id(dup))