Task Description: Implement a Simple Calculator Functionality
You are required to create a basic calculator functionality in a new file located at /app/calculator.py. The calculator should perform the following operations: addition, subtraction, multiplication, and division on two numerical inputs. The operations must be defined in a class named Calculator.
Requirements:
Class Definition:
Create a class named Calculator.
Methods:
Implement the following methods within the Calculator class:
add(a: float, b: float) -> float:
Returns the sum of a and b.
subtract(a: float, b: float) -> float:
Returns the result of a - b.
multiply(a: float, b: float) -> float:
Returns the product of a and b.
divide(a: float, b: float) -> float:
Returns the result of a / b. If b is 0, raise a ValueError with the message "Division by zero is not allowed."
Testing:
Ensure that the methods handle both integer and float inputs correctly. The implementation should account for floating-point arithmetic issues and return results with appropriate precision.
Error Handling:
The divide method must handle division by zero and raise the specified error.
Docstrings:
Each method should include a docstring that explains its purpose, parameters, and return value.
Once implemented, the calculator functionality in /app/calculator.py should pass all existing unit tests related to the operations defined above.