Esempio n. 1
0
 def testFunkyKeyIteration(self):
     # The internal set iteration protocol allows "iterating over" a
     # a single key as if it were a set.
     N = 100
     union, mkset = self.union, self.mkset
     slow = mkset()
     for i in range(N):
         slow = union(slow, mkset([i]))
     fast = self.multiunion(range(N))  # acts like N distinct singleton sets
     self.assertEqual(len(slow), N)
     self.assertEqual(len(fast), N)
     self.assertEqual(list(slow), list(fast))
     self.assertEqual(list(fast), range(N))
Esempio n. 2
0
 def testFunkyKeyIteration(self):
     # The internal set iteration protocol allows "iterating over" a
     # a single key as if it were a set.
     N = 100
     union, mkset = self.union, self.mkset
     slow = mkset()
     for i in range(N):
         slow = union(slow, mkset([i]))
     fast = self.multiunion(range(N))  # acts like N distinct singleton sets
     self.assertEqual(len(slow), N)
     self.assertEqual(len(fast), N)
     self.assertEqual(list(slow), list(fast))
     self.assertEqual(list(fast), range(N))
Esempio n. 3
0
 def testLotsOfLittleOnes(self):
     from random import shuffle
     N = 5000
     inputs = []
     mkset, mktreeset = self.mkset, self.mktreeset
     for i in range(N):
         base = i * 4 - N
         inputs.append(mkset([base, base + 1]))
         inputs.append(mktreeset([base + 2, base + 3]))
     shuffle(inputs)
     output = self.multiunion(inputs)
     self.assertEqual(len(output), N * 4)
     self.assertEqual(list(output), range(-N, 3 * N))
Esempio n. 4
0
 def testLotsOfLittleOnes(self):
     from random import shuffle
     N = 5000
     inputs = []
     mkset, mktreeset = self.mkset, self.mktreeset
     for i in range(N):
         base = i * 4 - N
         inputs.append(mkset([base, base+1]))
         inputs.append(mktreeset([base+2, base+3]))
     shuffle(inputs)
     output = self.multiunion(inputs)
     self.assertEqual(len(output), N*4)
     self.assertEqual(list(output), range(-N, 3*N))
Esempio n. 5
0
 def mkset(self, *args):
     from BTrees.LFBTree import LFSet as mkset
     return mkset(*args)
Esempio n. 6
0
 def mkset(self, *args):
     from BTrees.IOBTree import IOSet as mkset
     return mkset(*args)
Esempio n. 7
0
 def mkset(self, *args):
     from BTrees.IIBTree import IISetPy as mkset
     return mkset(*args)
Esempio n. 8
0
 def mkset(self, *args):
     from BTrees.IIBTree import IISetPy as mkset
     return mkset(*args)
Esempio n. 9
0
 def mkset(self, *args):
     from BTrees.LFBTree import LFSet as mkset
     return mkset(*args)
Esempio n. 10
0
 def mkset(self, *args):
     from BTrees.IOBTree import IOSet as mkset
     return mkset(*args)