def test_elfi(self): self.assertEqual( calculate.elfi([0.2, 0.5, 0.05, 0.25]), 0.64500000000000002 ) self.assertEqual(calculate.elfi([1]), 0) self.assertEqual(calculate.elfi([0.5, 0.5]), 0.5) self.assertRaises(ValueError, calculate.elfi, ['a', 0.2, 3])
def test_elfi(self): self.assertEqual(calculate.elfi([0.2, 0.5, 0.05, 0.25]), 0.64500000000000002) self.assertEqual(calculate.elfi([1]), 0) self.assertEqual(calculate.elfi([0.5, 0.5]), 0.5) self.assertRaises(ValueError, calculate.elfi, ['a', 0.2, 3])
def test_mean(self): self.assertEqual(calculate.mean([1,2,3]), 2.0) self.assertEqual(calculate.mean([1, 99]), 50.0) self.assertEqual(calculate.mean([2,3,3]), 2.6666666666666665) with self.assertRaises(ValueError): calculate.elfi(['a', 0.2, 3])