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