def test_should_merge_bucket_counts_correctly(self):
     for d1, d2, _ in self.merge_triples:
         d1_start = list(d1.bucketCounts)
         d2_start = list(d2.bucketCounts)
         want = [x + y for (x,y) in zip(d1_start, d2_start)]
         distribution.merge(d1, d2)
         expect(d2.bucketCounts).to(equal(want))
 def test_should_merge_bucket_counts_correctly(self):
     for d1, d2, _ in self.merge_triples:
         d1_start = list(d1.bucketCounts)
         d2_start = list(d2.bucketCounts)
         want = [x + y for (x, y) in zip(d1_start, d2_start)]
         distribution.merge(d1, d2)
         expect(d2.bucketCounts).to(equal(want))
 def test_should_merge_stats_correctly(self):
     # TODO(add a check of the variance)
     for d1, d2, _ in self.merge_triples:
         distribution.merge(d1, d2)
         expect(d2.count).to(equal(2))
         expect(d2.mean).to(equal((_HIGH_SAMPLE + _LOW_SAMPLE) / 2))
         expect(d2.maximum).to(equal(_HIGH_SAMPLE))
         expect(d2.minimum).to(equal(_LOW_SAMPLE))
 def test_should_merge_stats_correctly(self):
     # TODO(add a check of the variance)
     for d1, d2, _ in self.merge_triples:
         distribution.merge(d1, d2)
         expect(d2.count).to(equal(2))
         expect(d2.mean).to(equal(old_div((_HIGH_SAMPLE + _LOW_SAMPLE), 2)))
         expect(d2.maximum).to(equal(_HIGH_SAMPLE))
         expect(d2.minimum).to(equal(_LOW_SAMPLE))
 def test_should_fail_on_dissimilar_bucket_options(self):
     explicit = _make_explicit_dist()
     linear = _make_linear_dist()
     exponential = _make_exponential_dist()
     pairs = ((explicit, linear), (explicit, exponential), (linear,
                                                            exponential))
     for p in pairs:
         testf = lambda: distribution.merge(*p)
         expect(testf).to(raise_error(ValueError))
 def test_should_fail_on_dissimilar_bucket_options(self):
     explicit = _make_explicit_dist()
     linear = _make_linear_dist()
     exponential = _make_exponential_dist()
     pairs = (
         (explicit, linear),
         (explicit, exponential),
         (linear, exponential)
     )
     for p in pairs:
         testf = lambda: distribution.merge(*p)
         expect(testf).to(raise_error(ValueError))
 def test_should_fail_on_dissimilar_bucket_counts(self):
     for _, d2, d3 in self.merge_triples:
         testf = lambda: distribution.merge(d2, d3)
         expect(testf).to(raise_error(ValueError))
 def test_should_fail_on_dissimilar_bucket_counts(self):
     for _, d2, d3 in self.merge_triples:
         testf = lambda: distribution.merge(d2, d3)
         expect(testf).to(raise_error(ValueError))