Skip to main content

Simple assertion library for unit testing in python with a fluent API

Project description

Simple assertions library for unit testing in Python with a nice fluent API. Supports both Python 2 and 3.

Usage

Just import the assert_that function, and away you go…:

from assertpy import assert_that

def test_something():
    assert_that(1 + 2).is_equal_to(3)
    assert_that('foobar').is_length(6).starts_with('foo').ends_with('bar')
    assert_that(['a', 'b', 'c']).contains('a').does_not_contain('x')

Of course, assertpy works best with a python test runner like pytest (our favorite) or Nose.

Install

The assertpy library is available via PyPI. Just install with:

pip install assertpy

Or, if you are a big fan of conda like we are, there is an assertpy-feedstock for Conda-Forge that you can use:

conda install assertpy --channel conda-forge

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 assertpy, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size assertpy-1.1.tar.gz (25.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page