def test_mean(self): V = [5, 4, 0] self.assertEqual(g.getmean(V), 3)
def test_empty(self): V = [] # m = 0 self.assertIsNone(g.getmean(V))
def test_Rmean(self): V = [] for i in range(100): V.append(random.randint(1, 100)) self.assertEqual(g.getmean(V), sum(V) / len(V))
def test_getmean_one_one(self): self.assertEqual(cs.getmean([1]), 1)
def test_getmean_none(self): self.assertIsNone(cs.getmean([]))
def test_getmean_random(self): for i in range(0, 100): randnum = ra.randint(1, 100) constlist = [randnum] * ra.randint(1, 100) self.assertEqual(cs.getmean(constlist), randnum)