No Tautological Test

A tautological test checks code against itself. It can pass even when the answer is wrong.

Tell your agent to avoid these tests. Expected answers should come from the requirement.

For example: a $100 entry with a 10% profit target should produce $110.

These simplified examples contain a deliberate bug. In Python, * means multiply, and assert checks whether a statement is true.

Bad test: the function supplies both answers.

def target_price(entry):
    return entry * 0.10  # Bug: calculates only the $10 profit.

actual = target_price(100)    # 10
expected = target_price(100)  # 10

assert actual == expected    # Passes despite the bug.

Good test: the requirement supplies the expected answer.

def target_price(entry):
    return entry * 0.10  # Same bug.

actual = target_price(100)  # 10
expected = 110             # $100 entry + $10 profit.

assert actual == expected  # Fails and detects the bug.

Fix the function by adding the entry price:

def target_price(entry):
    return entry + (entry * 0.10)

assert target_price(100) == 110  # Passes with the correct result.

Add this to your AGENTS.md:

- Reject tautological tests.