Paste a function, get a complete test suite with happy paths, edge cases, and error conditions.

Prompt

Generate a comprehensive unit test suite for the following code.

Language: [LANGUAGE]
Test framework: [e.g., pytest, Jest, Go testing, JUnit]

Include:
1. Happy path tests for expected behavior
2. Edge cases (empty inputs, boundaries, nulls, large values)
3. Error conditions and exception handling
4. Mocking of external dependencies where needed

Use descriptive test names that explain the scenario being tested.

Code to test:
[PASTE CODE HERE]

Example

Input:

Language: Python
Test framework: pytest

Code to test:
def divide(a: float, b: float) -> float:
    if b == 0:
        raise ValueError("Cannot divide by zero")
    return a / b

Output:

import pytest
from module import divide

def test_divide_positive_numbers():
    assert divide(10, 2) == 5.0

def test_divide_negative_numbers():
    assert divide(-10, 2) == -5.0

def test_divide_returns_float():
    assert divide(7, 2) == 3.5

def test_divide_by_zero_raises_value_error():
    with pytest.raises(ValueError, match="Cannot divide by zero"):
        divide(10, 0)

def test_divide_with_zero_numerator():
    assert divide(0, 5) == 0.0

def test_divide_very_large_numbers():
    assert divide(1e18, 1e9) == 1e9