def test_median(self): h = Histogram() for i in range(1, 11): h.add(i) self.assertEqual(5.5, h.median()) h.add(11) self.assertEqual(6, h.median())
def test_add(self): h = Histogram() h.add(1) h.add(1) self.assertEqual(2, h[1]) h.add(1, 4) self.assertEqual(6, h[1])
def test_median(self): h = Histogram() for i in range(1, 11): h.add(i) assert h.median() == 5.5 h.add(11) assert h.median() == 6
def test_add(self): h = Histogram() h.add(1) h.add(1) assert h[1] == 2 h.add(1, 4) assert h[1] == 6
def test_add_operator(self): x = Histogram() y = Histogram() x.add(1) y.add(1, 4) z = x + y self.assertEqual(1, x[1]) self.assertEqual(4, y[1]) self.assertEqual(5, z[1])
def test_add_operator(self): x = Histogram() y = Histogram() x.add(1) y.add(1, 4) z = x + y assert x[1] == 1 assert y[1] == 4 assert z[1] == 5
def test_distib_stderr(self): h = Histogram() for i in range(0, 11): h.add(i) for i in range(4, 8): h.add(i) m = h.median() self.assertEqual(5, m) err = h.distribution_stderr(m, 1) self.assertEqual(116 / 15, err)
def test_distib_stderr(self): h = Histogram() for i in range(0, 11): h.add(i) for i in range(4, 8): h.add(i) m = h.median() assert m == 5 err = h.distribution_stderr(m, 1) assert err == 116 / 15