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)
 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)
def _make_linear_dist():
    return distribution.create_linear(3, 0.2, 0.1)
 def test_should_succeed_if_inputs_are_ok(self):
     num_finite_buckets = 1
     got = distribution.create_linear(num_finite_buckets, 0.1, 0.1)
     expect(len(got.bucketCounts)).to(equal(num_finite_buckets + 2))
 def test_should_fail_if_growth_factor_is_bad(self):
     testf = lambda: distribution.create_linear(1, -0.1, 0.1)
     expect(testf).to(raise_error(ValueError))
 def test_should_fail_if_num_finite_buckets_is_bad(self):
     testf = lambda: distribution.create_linear(0, 1.1, 0.1)
     expect(testf).to(raise_error(ValueError))
def _make_linear_dist():
    return distribution.create_linear(3, 0.2, 0.1)
 def test_should_succeed_if_inputs_are_ok(self):
     num_finite_buckets = 1
     got = distribution.create_linear(num_finite_buckets, 0.1, 0.1)
     expect(len(got.bucketCounts)).to(equal(num_finite_buckets + 2))
 def test_should_fail_if_growth_factor_is_bad(self):
     testf = lambda: distribution.create_linear(1, -0.1, 0.1)
     expect(testf).to(raise_error(ValueError))
 def test_should_fail_if_num_finite_buckets_is_bad(self):
     testf = lambda: distribution.create_linear(0, 1.1, 0.1)
     expect(testf).to(raise_error(ValueError))