Skip to content

pytest-assert-always-false (PT015)#

Derived from the flake8-pytest-style linter.

What it does#

Checks for assert statements whose test expression is a falsy value.

Why is this bad?# conveys the intent more clearly than assert falsy_value.


def test_foo():
    if some_condition:
        assert False, "some_condition was True"

Use instead:

import pytest

def test_foo():
    if some_condition:"some_condition was True")