Exemple #1
0
 def test_calc_none_bucket(self):
     with self.assertRaisesRegex(ab.ABTestError, "saw <class 'NoneType'>"):
         ab.calc(None, buckets=2)
Exemple #2
0
 def test_calc_100_buckets(self):
     self.assertEqual(ab.calc(99, buckets=100), 60)
Exemple #3
0
 def test_calc_3_buckets(self):
     self.assertEqual(ab.calc(99, buckets=3), 1)
     self.assertEqual(ab.calc(98, buckets=3), 0)
Exemple #4
0
 def test_calc_zero_2_buckets(self):
     self.assertEqual(ab.calc(0, buckets=2), 1)
Exemple #5
0
 def test_calc_1_bucket(self):
     with self.assertRaisesRegex(ab.ABTestError, 'saw 1'):
         ab.calc(0, buckets=1)
Exemple #6
0
 def test_calc_negative_bucket(self):
     with self.assertRaisesRegex(ab.ABTestError, 'saw -1'):
         ab.calc(0, buckets=-1)