Task Description: Implement a Simple Calculator Functionality
Your task is to implement a simple calculator that can perform basic arithmetic operations. The calculator should support addition, subtraction, multiplication, and division of two numbers.
Requirements:
Create a new file named calculator.py in the /app/ directory.
The calculator should consist of the following functions:
add(a: float, b: float) -> float: Returns the sum of a and b.
subtract(a: float, b: float) -> float: Returns the difference when b is subtracted from a.
multiply(a: float, b: float) -> float: Returns the product of a and b.
divide(a: float, b: float) -> float: Returns the division of a by b. If b is zero, raise a ValueError with the message "Cannot divide by zero."
Ensure that all functions handle input types correctly, i.e., they should accept both integers and floats.
Include docstrings for each function to describe its parameters and return type.
Implementation Example:
Input: add(2, 3) should return 5
Input: subtract(5, 2) should return 3
Input: multiply(4, 3) should return 12
Input: divide(10, 2) should return 5
Input: divide(10, 0) should raise ValueError.
Once implemented, run the provided test suite to ensure that your calculator functionalities pass all tests.