assert-tuple
What it does
Section titled “What it does”Reports an assert whose test is a tuple, usually the condition and the message written inside the parentheses.
Why it matters
Section titled “Why it matters”A tuple with elements is always true, so assert (x > 0, "x must be positive") never fails, and the check looks like it is there. Python warns about it when the file is compiled.
To fix, write the message after a comma outside the parentheses: assert x > 0, "x must be positive".
Example
Section titled “Example”x = 1assert (x, "message")assert x, "message"assert (x)assert ()Configuration
Section titled “Configuration”python: lint: rules: assert-tuple: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line assert-tuple in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | F631 |
full |