Example #1
0
 def test_multiplication(self):
     test_data = CsvReader(
         "../tests/Data/Unit Test Multiplication.csv").data
     for row in test_data:
         result = float(row['Result'])
         self.assertEqual(
             self.calculator.mult(row['Value 1'], row['Value 2']), result)
Example #2
0
 def test_division(self):
     test_data = CsvReader("../tests/Data/Unit Test Division.csv").data
     for row in test_data:
         result = float(row['Result'])
         self.assertEqual(
             self.calculator.divi(row['Value 1'], row['Value 2']), result)
         self.assertEqual(self.calculator.result, result)
Example #3
0
 def test_square_method_calculator(self):
     self.test_data = CsvReader(
         'src/Tests/CalculatorTests/data/square.csv').data
     for row in self.test_data:
         self.assertEqual(self.calculator.square(row['Value 1']),
                          Decimal(row['Result']))
         self.assertEqual(self.calculator.result, int(row['Result']))
Example #4
0
 def test_subtraction(self):
     test_data = CsvReader("../tests/data/Unit Test Subtraction.csv").data
     for row in test_data:
         result = float(row['Result'])
         self.assertEqual(
             self.calculator.subtracting(row['Value 1'], row['Value 2']),
             result)
         self.assertEqual(self.calculator.result, result)
 def test_subtract_method_calculator(self):
     self.test_data = CsvReader(
         'src/Tests/CalculatorTests/data/subtraction.csv').data
     for row in self.test_data:
         self.assertEqual(
             self.calculator.subtract(row['Value 1'], row['Value 2']),
             int(row['Result']))
         self.assertEqual(self.calculator.result, int(row['Result']))
Example #6
0
 def test_multiply_method_calculator(self):
     self.test_data = CsvReader(
         'src/Tests/CalculatorTests/data/multiplication.csv').data
     for row in self.test_data:
         self.assertEqual(
             self.calculator.multiply(row['Value 1'], row['Value 2']),
             Decimal(row['Result']))
         self.assertEqual(self.calculator.result, int(row['Result']))
Example #7
0
 def test_divide_method_calculator(self):
     self.test_data = CsvReader(
         'src/Tests/CalculatorTests/data/division.csv').data
     for row in self.test_data:
         self.assertEqual(
             self.calculator.divide(row['Value 1'], row['Value 2']),
             float(row['Result']))
         self.assertRaises(ZeroDivisionError,
                           self.calculator.divide('0', row['Value 2']))
    def test_p_value_calculator(self):
        self.statistics = Statistics()
        self.test_data = CsvReader(
            'src/Tests/StatisticsTests/data/p_value.csv').data

        for row in self.test_data:
            self.assertEqual(
                self.statistics.p_value(row['EVENT'], row['SAMPLES']),
                float(row['RESULT']))
            self.assertEqual(self.statistics.result, float(row['RESULT']))
Example #9
0
class MyTestCase(unittest.TestCase):
    def setUp(self) -> None:
        self.csv_reader = ReadCSV('src/Tests/CSVTests/data/addition.csv')

    def test_return_data_as_objects(self):
        values = self.csv_reader.return_data_as_objects('a_value')
        self.assertIsInstance(values, list)
        test_class = class_factory('a_value', self.csv_reader.data[0])
        for a_value in values:
            self.assertEqual(a_value[0], test_class[0])
    def test_proportion_calculator(self):
        self.statistics = Statistics()
        self.test_data = CsvReader(
            'src/Tests/StatisticsTests/data/proportion.csv').data

        for row in self.test_data:
            self.assertEqual(
                self.statistics.get_proportion(row['SAMPLE SIZE'],
                                               row['OUTCOMES']),
                float(row['RESULT']))
            self.assertEqual(self.statistics.result, float(row['RESULT']))
Example #11
0
 def test_square_root(self):
     test_data = CsvReader("../tests/Data/Unit Test Square Root.csv").data
     for row in test_data:
         result = round(float(row['Result']), 8)
         self.assertEqual(self.calculator.root(row['Value 1']), result)
         self.assertEqual(self.calculator.result, result)
Example #12
0
 def test_square(self):
     test_data = CsvReader("../tests/Data/Unit Test Square.csv").data
     for row in test_data:
         result = float(row['Result'])
         self.assertEqual(self.calculator.squ(row['Value 1']), result)
Example #13
0
 def test_square_root_method_calculator(self):
     self.test_data = CsvReader('src/Tests/CalculatorTests/data/squareRoot.csv').data
     for row in self.test_data:
         self.assertEqual(self.calculator.square_root(row['Value 1']), float(row['Result']))
         self.assertEqual(self.calculator.result, float(row['Result']))
Example #14
0
 def setUp(self) -> None:
     self.csv_reader = ReadCSV('src/Tests/CSVTests/data/addition.csv')