This rule raises an issue when using an assert statement on a tuple literal.
When tested for truthiness, a sequence or collection will evaluate to False if it is empty (its __len__ method returns 0)
and to True if it contains at least one element.
Using the assert statement on a tuple literal will therefore always fail if the tuple is empty, and always succeed otherwise.
The assert statement does not take parentheses around its parameters. Calling assert(x, y) will test if the tuple
(x, y) is True, which is always the case.
There are two possible fixes:
True, test each value separately.
def test_values(a, b):
assert (a, b) # Noncompliant: will always be True
def test_values(a, b):
# If you mean to test "a" and use "b" as an error message
assert a, b
# If you mean to test the values of "a" and "b"
assert a and b