def test_chart_computes_sample_statistics(self): series = (1, 2, 2, 3, 3, 3, 2, 2, 1) chart = ControlChart(series) self.assertAlmostEqual(2.1111, chart.mean(), places=4) self.assertEquals(2, chart.median()) self.assertAlmostEqual(0.78173, chart.std_dev(), places=3) self.assertEquals(len(series), chart.count())
def test_series_under_control(self): chart = ControlChart(SERIES_UNDER_CONTROL) self.assertEquals(10.05, chart.mean()) self.assertEquals(10.05, chart.median()) self.assertAlmostEquals(0.8737, chart.std_dev(), places=4) self.assertAlmostEquals(7.429, chart.lower_control_limit(), places=3) self.assertAlmostEquals(12.671, chart.upper_control_limit(), places=3) self.assertEquals([], chart.points_outside_lcl()) self.assertEquals([], chart.points_outside_ucl())