Exemplo n.º 1
0
 def test_setListOfVals_return_None(self):
     listOfVals = [0, 2, 4, 6, 8, 10]
     newList = [1, 3, 5, 7, 9]
     stats = Statistics(listOfVals)
     stats.setListOfVals(newList)
     actual = stats.getList()
     expected = [1, 3, 5, 7, 9]
     self.assertEqual(actual, expected)
Exemplo n.º 2
0
 def testZScorelistReturnList(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     actual = stat.zscore()
     expected = {
         1: -1.414213562373095,
         2: -0.7071067811865475,
         3: 0.0,
         4: 0.7071067811865475,
         5: 1.414213562373095
     }
     self.assertEqual(expected, actual)
Exemplo n.º 3
0
 def testnegativeCorrelationCoefficientReturnsRvalue(self):
     list = [-1, -2, -3, -4, -5]
     stat = Statistics(list)
     expected = -0.9999999999999998
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)
Exemplo n.º 4
0
 def testpopulationstandarddeviation_returns_std(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     actual = stat.standardDeviation()
     expected = 1.4142135623730951
     self.assertEqual(expected, actual)
Exemplo n.º 5
0
 def testcorrelationCoefficientReturnsRvalue(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     expected = 0.9999999999999998
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)
Exemplo n.º 6
0
 def testChebyshevInequalityreturnNone(self):
     emptyList = []
     stat = Statistics(emptyList)
     actual = stat.chebyshevInequality()
     expected = None
     self.assertEqual(expected, actual)
Exemplo n.º 7
0
 def test_arthmeticMean_return_3(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     actual = stat.arithmeticMean()
     expected = 3
     self.assertEqual(actual, expected)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 def test_medianOddList_return_3(self):
     oddList = [1, 2, 3, 4, 5]
     stat = Statistics(oddList)
     actual = stat.median()
     expected = 3
     self.assertEqual(expected, actual)
Exemplo n.º 10
0
 def testPlotDataMeanLargeDataSetReturnGraph(self):
     list = []
     for i in range(0, 99):
         list.append(random.randint(0, 99))
     stat = Statistics(list)
     stat.plotDataMean()
Exemplo n.º 11
0
 def testZScoreEmptyListReturnNone(self):
     emptylist = []
     stat = Statistics(emptylist)
     actual = stat.zscore()
     expected = None
     self.assertEqual(expected, actual)
Exemplo n.º 12
0
 def testPlotDataReturnGraph(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     stat.plotData()
Exemplo n.º 13
0
 def testPlotDataMeanEmptyDataSetReturnGraph(self):
     emptylist = []
     stat = Statistics(emptylist)
     stat.plotDataMean()
Exemplo n.º 14
0
 def testPlotDataReturnEmptyGraph(self):
     emptyList = []
     stat = Statistics(emptyList)
     stat.plotData()
Exemplo n.º 15
0
 def test_rangeList_return_none(self):
     emptyList = []
     stat = Statistics(emptyList)
     actual = stat.rangeList()
     expected = None
     self.assertEqual(actual, expected)
Exemplo n.º 16
0
 def testChebyshevInequalityreturnCI(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     actual = stat.chebyshevInequality()
     expected = 0.5000000000000001
     self.assertEqual(expected, actual)
Exemplo n.º 17
0
 def testsameDataSetCorrelationCoefficientReturnsRvalue(self):
     list = [1, 2, 1, 2, 1]
     stat = Statistics(list)
     expected = 0
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)
Exemplo n.º 18
0
 def testZScoreOneValuelistReturnList(self):
     list = [1]
     stat = Statistics(list)
     actual = stat.zscore()
     expected = {1: 0}
     self.assertEqual(expected, actual)
Exemplo n.º 19
0
 def testoneOffCorrelationCoefficientReturnsRvalue(self):
     list = [1, 2, 1, 2, 5]
     stat = Statistics(list)
     expected = 0.7698003589195009
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)
Exemplo n.º 20
0
 def test_negativeMin_rangeList_return_range(self):
     listOfVal = [-1, 2, 3, 4, 5]
     stat = Statistics(listOfVal)
     actual = stat.rangeList()
     expected = 6
     self.assertEqual(actual, expected)
Exemplo n.º 21
0
 def test_medianEmtpyList_return_none(self):
     emptyList = []
     stat = Statistics(emptyList)
     actual = stat.median()
     expected = None
     self.assertEqual(expected, actual)
Exemplo n.º 22
0
 def test_getListOfVals_returns_List(self):
     listOfVals = [0, 2, 4, 6, 8, 10]
     stats = Statistics(listOfVals)
     actual = stats.getList()
     expected = [0, 2, 4, 6, 8, 10]
     self.assertEqual(actual, expected)
Exemplo n.º 23
0
 def test_medianEvenList_return_2_5(self):
     evenList = [1, 2, 3, 4]
     stat = Statistics(evenList)
     actual = stat.median()
     expected = 2.5
     self.assertEqual(expected, actual)
Exemplo n.º 24
0
 def testsamplestandarddeviation_returns_std(self):
     list = [1, 2, 3, 4, 5]
     stat = Statistics(list)
     actual = stat.standardDeviation(population=False)
     expected = 1.5811388300841898
     self.assertEqual(actual, expected)
Exemplo n.º 25
0
 def test_negativeMinMax_rangeList_return_range(self):
     listOfVal = [-1, -2, -3, -4, -5]
     stat = Statistics(listOfVal)
     actual = stat.rangeList()
     expected = 4
     self.assertEqual(actual, expected)
Exemplo n.º 26
0
 def testZScoreSameValuelistReturnList(self):
     list = [1, 1, 1, 1, 1]
     stat = Statistics(list)
     actual = stat.zscore()
     expected = None
     self.assertEqual(expected, actual)
Exemplo n.º 27
0
 def test__rangeListsameInterval_return_range(self):
     listOfVal = [1, 1, 1]
     stat = Statistics(listOfVal)
     actual = stat.rangeList()
     expected = 0
     self.assertEqual(actual, expected)
Exemplo n.º 28
0
 def testcorrelationCoefficientReturnsNone(self):
     emptyList = []
     stat = Statistics(emptyList)
     expected = None
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)
Exemplo n.º 29
0
 def test_arithmeticMean_return_1(self):
     list = [1, 1, 1]
     stat = Statistics(list)
     actual = stat.arithmeticMean()
     expected = 1
     self.assertEqual(actual, expected)
Exemplo n.º 30
0
 def testcorrelationCoefficientReturnsZero(self):
     list = [1]
     stat = Statistics(list)
     expected = 0
     actual = stat.correlationCoefficient()
     self.assertEqual(expected, actual)