assert-on-string-literal / W0129ΒΆ

Message emitted:

Assert statement has a string literal as its first argument. The assert will %s fail.

Description:

Used when an assert statement has a string literal as its first argument, which will cause the assert to always pass.

Correct code:

def test():
    # Nothing, as an assert of a string literal will always pass

Problematic code:

def test():
    assert "There is an AssertionError"  # [assert-on-string-literal]

Created by basic checker