Develop a simple calculator application that can perform basic arithmetic operations: addition, subtraction, multiplication, and division. The functionality should be encapsulated within a Calculator class located in the /app/ directory.
Requirements:
Class Structure:
Create a class named Calculator in a file named calculator.py within the /app/ directory.
Method Implementations:
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 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 result of dividing a by b. If b is 0, raise a ValueError with the message "Cannot divide by zero".
Validation:
Ensure that the inputs a and b for all methods are of type float. If not, raise a TypeError with the message "Inputs must be of type float".
Testing:
Ensure that the implemented methods pass the provided tests, which check for correctness in arithmetic operations and proper error handling for division by zero and type validation.
By completing this task, you will provide a functional calculator that satisfies the outlined methods and handles errors appropriately.