def test_basic(self): """ Calcul the variance of a list of number """ data = [186.0, 699, 132, 272, 291, 331, 199, 1890, 788, 1601] expected = 391417.8777777777 result = Math.variance(data) self.assertEqual(result, expected)
def test_no_value(self): """ Calcul the sum of a list of number The list is empty """ data = list() expected = 0 result = Math.sum(data) self.assertEqual(result, expected)
def test_two_value(self): """ Calcul the variance of a list of number The list have only TWO number """ data = [186.0, 192.3] expected = 19.84500000000007 result = Math.variance(data) self.assertEqual(result, expected)
def test_one_value(self): """ Calcul the sum of a list of number There is only ONE value """ data = [ 186.0 ] expected = 186 result = Math.sum(data) self.assertEqual(result, expected)
def test_one_value(self): """ Calcul the mean of a list of number The list have only ONE number """ data = [ 186.0 ] expected = 186.0 result = Math.mean(data) self.assertEqual(result, expected)
def test_one_value(self): """ Calcul the variance of a list of number The list have only ONE number """ data = [186.0] expected = "ZeroDivisionError" try: result = Math.variance(data) except ZeroDivisionError: result = "ZeroDivisionError" self.assertEqual(result, expected)
def test_no_value(self): """ Calcul the mean of a list of number The list is empty """ data = list() expected = "ZeroDivisionError" try: result = Math.mean(data) except ZeroDivisionError: result = "ZeroDivisionError" self.assertEqual(result, expected)
def test_basic(self): """ Calcul the sum of a list of number """ data = [ 186.0, 699, 132, 272, 291, 331, 199, 1890, 788, 1601 ] expected = 6389 result = Math.sum(data) self.assertEqual(result, expected)