Exemplo n.º 1
0
 def testCounterRange(self):
     s1 = ShardCounterGenerator(start=0,length=5)
     s2 = ShardCounterGenerator(start=5,length=5)
     for i in range(1,6):
         self.assertEquals(s1.next(),i)
         self.assertEquals(s2.next(),i+5)
     self.assertEquals(s1.next(),None)
     self.assertEquals(s2.next(),None)
Exemplo n.º 2
0
 def testCounterNoNext(self):
     s = ShardCounterGenerator(start=0,length=1)
     self.assertEquals(1,s.next())
     self.assertFalse(s.hasNext())
Exemplo n.º 3
0
 def testCounterLimit(self):
     s = ShardCounterGenerator(start=0,length=5)
     for i in range(1,6):
         self.assertEquals(s.next(),i)
     self.assertEquals(s.next(),None)
Exemplo n.º 4
0
 def testSimpleShardWorks(self):
     s = ShardCounterGenerator(start=0)
     self.assertEquals(s.next(),1)