Skip to content

no-statically-truthy-assertion

A bare assertion condition is statically truthy.

Why

A condition that stays truthy whenever evaluation succeeds cannot reject an incorrect result and often means the intended condition was wrapped in a container or placed in the message slot.

Fix

Assert an explicit runtime-derived condition. If the test only requires an operation not to raise, evaluate it directly and retain any meaningful follow-up assertion.

Examples

Before — flagged The intended condition became an assertion message
tests/test_service.py
def test_service(response):
assert True, response.status_code == 200
After — preferred Assertion checks runtime output
tests/test_service.py
def test_service(response):
assert response.status_code == 200

Formerly: no-tautological-expect