no assert on tuples

Metadata

ID: python-best-practices/no-assert-on-tuples

Language: Python

Severity: Error

Category: Error Prone

Description

Do not assert on tuples. Asserting on tuples will always evaluate to True if the tuple is not empty. Instead, assert on each value rather than asserting on a tuple.

Non-Compliant Code Examples

assert (1, 2)  # do not assert on tuples

Compliant Code Examples

assert x

assert exitcode == 42, (stdout, stderr)
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis