Task Description: Implement a Basic Calculator Functionality
You are required to create a basic calculator application that can perform simple arithmetic operations: addition, subtraction, multiplication, and division. The implementation must be placed in the /app/ directory.
Specific Requirements:
Function Definition: Create a function named calculate that takes three parameters:
num1 (float): The first number for the calculation.
operator (str): A string that represents the operation to be performed. It can be one of the following: +, -, *, /.
num2 (float): The second number for the calculation.
Operations:
If the operator is +, the function should return the sum of num1 and num2.
If the operator is -, the function should return the difference of num1 and num2.
If the operator is *, the function should return the product of num1 and num2.
If the operator is /, the function should perform division but handle division by zero gracefully by returning None.
Error Handling: If an invalid operator is provided (anything other than +, -, *, or /), the function should raise a ValueError with the message "Invalid operator".
Return Type: The function should always return a float if the operation is valid, otherwise return None for division by zero.
Documentation: Include docstrings to explain the function's purpose, parameters, return value, and any exceptions raised.
Make sure to write unit tests to verify all functionality and edge cases as suggested by the provided test code. The implementation should match the function signatures expected by the tests.