DocsGuidesFirst gap

Find Your First Gap

This walkthrough uses a simple payments module. By the end, you'll have a verified test written to your test file.

Start with a function that has a docstring

# src/payments.py
def process_payment(amount: float, currency: str) -> dict:
    """
    Process a payment.

    Args:
        amount: Payment amount in the specified currency.
        currency: ISO 4217 currency code (e.g., "USD").

    Raises:
        ValueError: If amount is zero or negative.
        ValueError: If currency is not a supported 3-letter code.

    Returns:
        dict: Payment confirmation with transaction ID.
    """
    if amount <= 0:
        raise ValueError(f"Amount must be positive, got {amount}")
    if len(currency) != 3:
        raise ValueError(f"Invalid currency code: {currency}")
    # ... payment logic

Run quell find

quell find src/payments.py

Quell reads the docstring, extracts the Raises requirements, checks your test files, and reports:

Found 2 untested requirements:

✗ test_payment_rejects_zero_amount     — no test found
✗ test_payment_rejects_invalid_currency — no test found

Write the tests

quell find src/payments.py --fix

Quell generates tests and runs them through the 5-gate pipeline:

Gate 1 ✓ AST valid
Gate 2 ✓ Not a duplicate
Gate 3 ✓ No side effects
Gate 4 ✓ Passes correct code
Gate 5 ✓ Fails with violation injected

Writing tests/test_payments.py...
✓ WRITTEN test_payment_rejects_zero_amount
✓ WRITTEN test_payment_rejects_invalid_currency

Confirm the tests

# tests/test_payments.py (generated by Quell)
def test_payment_rejects_zero_amount():
    with pytest.raises(ValueError):
        process_payment(amount=0, currency="USD")

def test_payment_rejects_invalid_currency():
    with pytest.raises(ValueError):
        process_payment(amount=10.0, currency="US")

Run them:

pytest tests/test_payments.py -v
# 2 passed in 0.05s

That's it. Two verified, proven tests in under a minute.