Ejemplo n.º 1
0
 def test_group_batch_modulo(self):
     grouper = PythonExpGrouper(self.options_value_modulo['grouper'])
     batch = get_batch()
     grouped = grouper.group_batch(batch)
     for item in grouped:
         modulo = item.group_membership[0]
         self.assertTrue(item['value'] % 5 == modulo)
Ejemplo n.º 2
0
 def test_group_batch_is_in(self):
     grouper = PythonExpGrouper(self.options_exp_in['grouper'])
     batch = get_batch()
     grouped = grouper.group_batch(batch)
     for item in grouped:
         is_in = item.group_membership[0]
         self.assertTrue((item['country_code'] in ['uk', 'us']) == is_in)
Ejemplo n.º 3
0
 def test_group_batch_multiple(self):
     grouper = PythonExpGrouper(self.options_multiple['grouper'])
     batch = get_batch()
     grouped = grouper.group_batch(batch)
     for item in grouped:
         is_in, modulo = item.group_membership
         self.assertTrue((item['country_code'] in ['uk', 'us']) == is_in)
         self.assertTrue(item['value'] % 5 == modulo)
Ejemplo n.º 4
0
 def test_group_batch_invalid(self):
     grouper = PythonExpGrouper(self.options_invalid['grouper'])
     batch = get_batch()
     grouped = grouper.group_batch(batch)
     with self.assertRaises(Exception):
         next(grouped)