Example #1
0
 def test_squared(self):
     test_data = CSVReader(
         '/Tests/Data_Calculator/Unit Test Square.csv').data
     for row in test_data:
         self.assertEqual(self.calculator.squared(row['Value 1']),
                          int(row['Result']))
         self.assertEqual(self.calculator.result, int(row['Result']))
     test_data.clear()
Example #2
0
 def test_conf_int(self):
     test_data = CSVReader('/Tests/Data_PopSampling/ConfInt_Data.csv').data
     for row in test_data:
         self.assertEqual(
             self.PopSampling.conf_int(row['a'], row['b'], row['c'],
                                       row['d'], row['e']),
             float(row['ConfInt']))
         self.assertEqual(self.PopSampling.result, float(row['ConfInt']))
     test_data.clear()
Example #3
0
 def test_multiplication(self):
     test_data = CSVReader(
         '/Tests/Data_Calculator/Unit Test Multiplication.csv').data
     for row in test_data:
         self.assertEqual(
             self.calculator.multiply(row['Value 1'], row['Value 2']),
             int(row['Result']))
         self.assertEqual(self.calculator.result, int(row['Result']))
     test_data.clear()
 def test_mean(self):
     test_data = CSVReader('/Tests/Data_Statistics/Mean_Data.csv').data
     for row in test_data:
         self.assertEqual(
             self.Statistics.mean(row['Value1'], row['Value2'],
                                  row['Value3'], row['Value4'],
                                  row['Value5']), float(row['Mean']))
         self.assertEqual(self.Statistics.result, float(row['Mean']))
     test_data.clear()
Example #5
0
 def test_margin(self):
     test_data = CSVReader('/Tests/Data_PopSampling/Margin_Data.csv').data
     for row in test_data:
         self.assertEqual(
             self.PopSampling.margin(row['Value1'], row['Value2'],
                                     row['Value3'], row['Value4'],
                                     row['Value5']), float(row['Error']))
         self.assertEqual(self.PopSampling.result, float(row['Error']))
     test_data.clear()
Example #6
0
 def test_cochran(self):
     test_data = CSVReader('/Tests/Data_PopSampling/Cochran_Data.csv').data
     for row in test_data:
         #pprint(self.PopSampling.cochran(row['Z'], row['p'], row['q'], row['e']))
         self.assertEqual(
             self.PopSampling.cochran(row['Z'], row['p'], row['q'],
                                      row['e']), int(row['Sample']))
         self.assertEqual(self.PopSampling.result, int(row['Sample']))
     test_data.clear()
 def test_root(self):
     test_data = CSVReader(
         '/Tests/Data_Calculator/Unit Test Square Root.csv').data
     for row in test_data:
         self.assertAlmostEqual(self.calculator.root(row['Value 1']),
                                round(float(row['Result']), 9))
         self.assertAlmostEqual(round(float(row['Result']), 9),
                                round(self.calculator.result, 9))
     test_data.clear()
Example #8
0
 def test_division(self):
     test_data = CSVReader(
         '/Tests/Data_Calculator/Unit Test Division.csv').data
     for row in test_data:
         self.assertAlmostEqual(
             float(row['Result']),
             self.calculator.divide(row['Value 1'], row['Value 2']))
         self.assertAlmostEqual(float(row['Result']),
                                round(self.calculator.result, 9))
     test_data.clear()
Example #9
0
 def test_find_sample_size(self):
     test_data = CSVReader(
         '/Tests/Data_PopSampling/FindSample_Data.csv').data
     for row in test_data:
         self.assertEqual(
             self.PopSampling.find_sample_size(row['P'], row['q'],
                                               row['za2'], row['e']),
             int(row['Sample']))
         self.assertEqual(self.PopSampling.result, int(row['Sample']))
     test_data.clear()
 def test_mode(self):
     test_data = CSVReader('/Tests/Data_Statistics/Mode_Data.csv').data
     #pprint(test_data)
     for row in test_data:
         self.assertEqual(
             self.Statistics.mode(row['Value1'], row['Value2'],
                                  row['Value3'], row['Value4'],
                                  row['Value5']), int(row['Mode']))
         self.assertEqual(self.Statistics.result, int(row["Mode"]))
     test_data.clear()
 def test_z_score(self):
     test_data = CSVReader('/Tests/Data_Statistics/ZScore_Data.csv').data
     #pprint(test_data)
     for row in test_data:
         self.assertEqual(
             self.Statistics.z_score(row['Score'], row['Mean'],
                                     row['StDev']),
             round(float(row['Z-Score']), 2))
         self.assertEqual(self.Statistics.result,
                          round(float(row['Z-Score']), 2))
     test_data.clear()
 def test_variance(self):
     test_data = CSVReader('/Tests/Data_Statistics/Variance_Data.csv').data
     #pprint(test_data)
     for row in test_data:
         self.assertEqual(
             self.Statistics.variance(row['Value1'], row['Value2'],
                                      row['Value3'], row['Value4'],
                                      row['Value5']),
             round(float(row['Variance']), 2))
         self.assertEqual(self.Statistics.result,
                          round(float(row['Variance']), 2))
     test_data.clear()
 def test_standard_deviation(self):
     test_data = CSVReader(
         '/Tests/Data_Statistics/Standard_Deviation_Data.csv').data
     #pprint(test_data)
     for row in test_data:
         self.assertEqual(
             self.Statistics.standard_deviation(row['Value1'],
                                                row['Value2'],
                                                row['Value3'],
                                                row['Value4'],
                                                row['Value5']),
             round(float(row['StDev']), 2))
         self.assertEqual(self.Statistics.result,
                          round(float(row['StDev']), 2))
     test_data.clear()