Skip to main content

A simple flake8 Plugin that checks if assert is used

Project description


A simple flake8 Plugin that checks if assert is used

The assert Keyword is very useful in Python, but has one big problem: Python has a optimized mode. When using this, The assert Keyword will no longer work, so if you use assert in a Library, this can lead to Problems.

You should replace assert with this little function:

def assert_func(expression: bool) -> None:
    The assert keyword is not available when running Python in optimized mode.
    This function is a drop-in replacement.
    if not expression:
        raise AssertionError()

This makes sure, your will be working.

If you just write your own Program, which you don't use with the optimized mode or if you use something like pytest, you can use assert of course.

This Plugin just checks for the use of the assert Keyword. Nothing more.

List of warnings:

ID Description
AF100 Found assert

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-assert-finder-1.0.tar.gz (3.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page