def test_sqrt(self): test_data = csvreader('TestSquareRoot.csv').data for row in test_data: result = float(row['Result']) self.assertAlmostEqual(self.calculator.sqrt(row['Value 1']), result) self.assertAlmostEqual(self.calculator.result, result)
def test_addition(self): test_data = csvreader('TestAddition.csv').data for row in test_data: result = float(row['Result']) self.assertEqual( self.calculator.add(row['Value 1'], row['Value 2']), result) self.assertEqual(self.calculator.result, result)
def test_div(self): test_data = csvreader('TestDivision.csv').data for row in test_data: result = float(row['Result']) self.assertAlmostEqual( self.calculator.division(row['Value 1'], row['Value 2']), result) self.assertAlmostEqual(self.calculator.result, result)
def test_times(self): test_data = csvreader('TestMultiplication.csv').data for row in test_data: result = float(row['Result']) self.assertEqual( self.calculator.multiply(row['Value 1'], row['Value 2']), result) self.assertEqual(self.calculator.result, result)
def setUp(self) -> None: self.csv_reader = csvreader('Calculator/csvfiles/TestAddition.csv')