Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A utility package for making better test assertions

Project description

Build Status

Asserty

Asserty is a utility package that provides methods for better assertion in testing.

Installation

The package can be installed using pip:

$ pip install asserty

Examples

You make assertions by importing the assert_that function from the asserty package:

from asserty import assert_that

assert_that("str").not_equals("string")
assert_that(5).is_in(range(10))

def myfunc(arg):
    if not isinstance(arg, str):
        raise TypeError()
    return arg+"yay"

assert_that(myfunc).if_called_with(1).raises(TypeError)
assert_that(myfunc).if_called_with("Hey-").returns("Hey-yay")

Outside a test context that does not handle AssertionError you can import the equivalent function called that:

from asserty import that

assert that("str").not_equals("string")
assert that(5).is_in(range(10))

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 asserty, version 3.0.0
Filename, size File type Python version Upload date Hashes
Filename, size asserty-3.0.0-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size asserty-3.0.0.tar.gz (6.8 kB) File type Source Python version None Upload date Hashes View hashes

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