예제 #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)
예제 #2
0
 def testCounterNoNext(self):
     s = ShardCounterGenerator(start=0,length=1)
     self.assertEquals(1,s.next())
     self.assertFalse(s.hasNext())
예제 #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)
예제 #4
0
 def testSimpleShardWorks(self):
     s = ShardCounterGenerator(start=0)
     self.assertEquals(s.next(),1)