Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Delayed/soft assertions for python

Project description

PyPI version Downloads Downloads

Python-Delayed-Assert

Delayed aka. Soft asserts for python

Few features:

- No Dependenices on any other framework/library.
- Should work with any testing framework.
- Can be use as decorator or context manager.

Installation

Install via pip

    pip install delayed-assert

Install from master

    pip install git+https://github.com/pr4bh4sh/python-delayed-assert

Uses

See ExampleUnittest.py for usage.

Using assertion library with lambda

Pass the assertion call as

    lambda: self.assertListEqual([4,5,6,2,5],[7,8])

While I've tested only with unittest asserttion,It should be able to use any assertion library.

Keep in mind that, Python does not support statement inside lambda, so

    lambda: assert 1 == 1

won't work as it is not a valid lambda expression in python

Sample


Credit : http://pythontesting.net/strategy/delayed-assert/

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
delayed_assert-0.3.2-py3-none-any.whl (4.1 kB) Copy SHA256 hash SHA256 Wheel py3
delayed_assert-0.3.2.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page