def testMultiplication(self): rows = readCSV("tests/test_cases/Multiplication.csv") for row in rows: result = float(row["Result"]) x = float(row["Value 1"]) y = float(row["Value 2"]) self.assertAlmostEqual(self.calculator.multiply(x, y), result)
def testSubtraction(self): rows = readCSV("tests/test_cases/Subtraction.csv") for row in rows: result = float(row["Result"]) y = float(row["Value 1"]) x = float(row["Value 2"]) self.assertEqual(self.calculator.subtract(x, y), result)
def testDivision(self): self.assertRaises(ZeroDivisionError, self.calculator.divide, 1, 0) rows = readCSV("tests/test_cases/Division.csv") for row in rows: result = float(row["Result"]) y = float(row["Value 1"]) x = float(row["Value 2"]) self.assertAlmostEqual(self.calculator.divide(x, y), result)
def testSquareRoot(self): rows = readCSV("tests/test_cases/SquareRoot.csv") for row in rows: result = float(row["Result"]) x = float(row["Value 1"]) self.assertAlmostEqual(self.calculator.squareRoot(x), result)