Пример #1
0
    def testStandardDeviation(self):
        name = "test_stat"

        test_stat = Statistic(name, [2, 4, 4, 4, 5, 5, 7, 9], self.config)

        self.assertEqual(name, test_stat._name)

        stats = test_stat.stats()

        self.assertAlmostEqual(2, stats.get("stddev"))
Пример #2
0
    def testStats(self):
        name = "test_stat"

        test_stat = Statistic(name, [1, 2, 3], self.config)

        self.assertEqual(name, test_stat._name)

        stats = test_stat.stats()

        self.assertEqual(3, stats.get("count"))
        self.assertEqual(6, stats.get("total"))
        self.assertAlmostEqual(2, stats.get("mean"))
        self.assertAlmostEqual(0.8164966, stats.get("stddev"))