Skip to main content

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

Release files for assertpy 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for assertpy 1.1
File Size Uploaded
assertpy-1.1.tar.gz 25.4 kB Details

Release files / assertpy-1.1.tar.gz

Download URL assertpy-1.1.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
acc64329934ad71a3221de185517a43af33e373bb44dc05b5a9b174394ef4833
BLAKE2b-256 checksum
How to use checksums
4f39720b5d4463612a40a166d00999cbb715fce3edaf08a9a7588ba5985699ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

1.0

1 release file

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page