def test_clear(self): histogram = HistogramExponentiallyDecaying() histogram.clear() histogram.update(5) histogram.update(15) self.assertEqual(5, histogram.min) self.assertEqual(15, histogram.max)
def test_exponential_sample_2000(self): histogram = HistogramExponentiallyDecaying() for i in range(2000): histogram.update(i) self.assertEqual(1999, histogram.max)
def test_exponential_sample_mean(self): histogram = HistogramExponentiallyDecaying() histogram.update(5) histogram.update(10) self.assertEqual(7.5, histogram.mean)
def test_exponential_sample_snapshot(self): histogram = HistogramExponentiallyDecaying() for i in range(100): histogram.update(i) snapshot = histogram.snapshot self.assertEqual(49.5, snapshot.median)