def test_calculate(self): calculator = Calculator(operation="add", number1=10, number2=7) calculator.calculate() self.assertEqual(calculator.result, 17) calculator = Calculator(operation="subtract", number1=8, number2=7) calculator.calculate() self.assertEqual(calculator.result, 1)
def main(): try: args = _argparser.parse() calculator = Calculator(operation=args.operation, number1=args.number1, number2=args.number2) calculator.calculate() print("Result: ", calculator.result) except Exception as e: print(e) else: print('Success!') finally: print('Cleaning up.')