Skip to content

test-without-explicit-oracle

A collected test has no visible assertion or exception oracle.

Why

A test can execute a side effect without observing whether the intended effect occurred. The absence of an explicit oracle is a review candidate, not proof that a smoke or no-throw contract is weak.

Fix

Identify the intended contract. Reuse adequate existing coverage, observe the returned value, state, or emitted effect, or retain the test when successful execution is itself the contract. Do not add a tautological assertion or delete a test solely to silence this advisory.

Examples

Before — flagged Observe whether the requested side effect occurred
tests/test_delivery.py
def test_delivery():
deliver("hello")
After — preferred The assertion distinguishes a missing delivery
tests/test_delivery.py
def test_delivery(sender):
deliver("hello", sender)
assert sender.messages == ["hello"]