Skip to content

SCR111: assert-on-tuple

assert on a non-empty tuple is always true

Code SCR111
Name assert-on-tuple
Category Scripts (SCR)
Default severity warning
Enabled by default yes
Fix available no
ign-lint equivalent none

Reports assert (condition, "message"): an assertion whose test is a non-empty tuple.

A non-empty tuple is always true, so the assertion never fails. The parentheses turned the condition and the message into one tuple.

assert (len(rows) > 0, "no rows returned")

Use instead:

assert len(rows) > 0, "no rows returned"

Corresponds to W0199 assert-on-tuple.


Generated from the rule metadata by iglint generate-docs; iglint rule SCR111 prints the same page in the terminal. Source: docs/rules/SCR111.md.