assert-on-string-literal / W0129#
Assert statement has a string literal as its first argument. The assert will %s fail.
Used when an assert statement has a string literal as its first argument, which will cause the assert to always pass.
def test_division(): a = 9 / 3 assert "No ZeroDivisionError were raised" # [assert-on-string-literal]
def test_division(): a = 9 / 3 assert a == 3
Directly asserting a string literal will always pass. The solution is to test something that could fail, or not assert at all.
unittest assertions there is the similar redundant-unittest-assert / W1503 message.
Created by the basic checker.