예제 #1
0
 def test_key_added(self):
     test_data = [
         {'a': 'b'},
         {'a': 'b'}
     ]
     p = AutoIncrement('counter')
     p.bind(test_data)
     for i in p:
         self.assertIn('counter', i)
예제 #2
0
 def test_key_increment_start(self):
     test_data = [
         {'a': 'b'},
         {'a': 'b'}
     ]
     p = AutoIncrement('counter', start_value=2)
     p.bind(test_data)
     c = 2
     for i in p:
         c += 1
         self.assertIn('counter', i)
         self.assertEquals(i['counter'], c)
예제 #3
0
 def test_key_increment_interval(self):
     test_data = [
         {'a': 'b'},
         {'a': 'b'}
     ]
     p = AutoIncrement('counter', interval=2)
     p.bind(test_data)
     c = 0
     for i in p:
         c += 2
         self.assertIn('counter', i)
         self.assertEquals(i['counter'], c)