def testoneOffCorrelationCoefficientReturnsRvalue(self): list = [1, 2, 1, 2, 5] stat = Statistics(list) expected = 0.7698003589195009 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testLargeDataSetCorrelationCoefficientReturnsRvalue(self): list = [1, 2, 1, 2, 5, 2, 4, 6, 7, 9, 0, 2, 3, 4, 5, 7, 6] stat = Statistics(list) expected = 0.4665694748158436 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testsameDataSetCorrelationCoefficientReturnsRvalue(self): list = [1, 2, 1, 2, 1] stat = Statistics(list) expected = 0 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testnegativeCorrelationCoefficientReturnsRvalue(self): list = [-1, -2, -3, -4, -5] stat = Statistics(list) expected = -0.9999999999999998 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testcorrelationCoefficientReturnsRvalue(self): list = [1, 2, 3, 4, 5] stat = Statistics(list) expected = 0.9999999999999998 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testcorrelationCoefficientReturnsZero(self): list = [1] stat = Statistics(list) expected = 0 actual = stat.correlationCoefficient() self.assertEqual(expected, actual)
def testcorrelationCoefficientReturnsNone(self): emptyList = [] stat = Statistics(emptyList) expected = None actual = stat.correlationCoefficient() self.assertEqual(expected, actual)