Skip to content

not-in-test

Pythonstyleno fixdefault: off

Reports a membership test negated in front of the expression: not a in b.

a not in b is the operator for it. The prefix form is the same test, but a reader may take it as (not a) in b.

To fix, write a not in b.

Reported
a = b = 1
not a in b
not a not in b
a not in b
not (a in b)
python:
lint:
rules:
not-in-test: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line not-in-test in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff E713 full