Ejemplo n.º 1
0
 def setUp(self):
     self.merge_triples = (
         (
             distribution.create_exponential(3, 2, 0.1),
             distribution.create_exponential(3, 2, 0.1),
             distribution.create_exponential(4, 2, 0.1),
         ),(
             distribution.create_linear(3, 0.2, 0.1),
             distribution.create_linear(3, 0.2, 0.1),
             distribution.create_linear(4, 0.2, 0.1)
         ),(
             distribution.create_explicit([0.1, 0.3]),
             distribution.create_explicit([0.1, 0.3]),
             distribution.create_explicit([0.1, 0.3, 0.5]),
         )
     )
     for d1, d2, _ in self.merge_triples:
         distribution.add_sample(_LOW_SAMPLE, d1)
         distribution.add_sample(_HIGH_SAMPLE, d2)
Ejemplo n.º 2
0
def _make_exponential_dist():
    return distribution.create_exponential(3, 2, 0.1)
Ejemplo n.º 3
0
 def test_should_succeed_if_inputs_are_ok(self):
     num_finite_buckets = 1
     got = distribution.create_exponential(num_finite_buckets, 1.1, 0.1)
     expect(len(got.bucketCounts)).to(equal(num_finite_buckets + 2))
Ejemplo n.º 4
0
 def test_should_fail_if_scale_is_bad(self):
     testf = lambda: distribution.create_exponential(1, 1.1, -0.1)
     expect(testf).to(raise_error(ValueError))
Ejemplo n.º 5
0
 def test_should_fail_if_growth_factor_is_bad(self):
     testf = lambda: distribution.create_exponential(1, 0.9, 0.1)
     expect(testf).to(raise_error(ValueError))
Ejemplo n.º 6
0
 def test_should_fail_if_num_finite_buckets_is_bad(self):
     testf = lambda: distribution.create_exponential(0, 1.1, 0.1)
     expect(testf).to(raise_error(ValueError))
def _wanted_distribution_with_sample(value, *args):
    d = distribution.create_exponential(*args)
    distribution.add_sample(value, d)
    return d
def _wanted_distribution_with_sample(value, *args):
    d = distribution.create_exponential(*args)
    distribution.add_sample(value, d)
    return d