Home

Awesome

flake8-useless-assert

flake8 plugin to catch useless assert statements

Download or install on the PyPI page

Violations

CodeDescriptionExample
ULA001assert with a truthy literalassert "foo"
assert ...
assert True
ULA002assert with 0assert 0
ULA003assert with Noneassert None
ULA004assert with "literal".format(...)assert "foo {0}".format(bar)
ULA005assert with f-stringassert f"foo {bar}"
ULA006assert with constant computationassert "foo" == "bar" * 3
assert repr("fizz") == "'buzz'"

Testing

I haven't set up proper testing yet, but you can run poetry install and then:

flake8 examples/