Skip to main content

A tool for fixing bare assert statements

Project description

Assert Info fixes up bare assert statements in your code so they include diagnostics when they they’re hit.

A problem that crops up when working in legacy code bases is the use of assert X == Y, when this fails you get minimal diagnostics.

Whilst Pytest solves this by playing with AST at run time, inserting diagnostics on the fly, you can’t just run all your code with Pytest.

The standard libraries unittest solves this problem with helper functions that include extra diagnostics by default, for instance assertEqual.

This package will inspect any file and replace assert statement which aren’t accompanied by a message with a unittest style assertion so that when it fails you get diagnostics!

To run the script:

pip install assert-info
assert-info -h

Project details


Download files

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

Files for assert-info, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size assert_info-0.2.1-py2.py3-none-any.whl (5.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size assert-info-0.2.1.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page