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

Download files

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

Source Distribution

assertpy-1.1.tar.gz (25.4 kB view details)

Uploaded Source

File details

Details for the file assertpy-1.1.tar.gz.

File metadata

  • Download URL: assertpy-1.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for assertpy-1.1.tar.gz
Algorithm Hash digest
SHA256 acc64329934ad71a3221de185517a43af33e373bb44dc05b5a9b174394ef4833
MD5 f9bd832653d6372159640a093e2b3220
BLAKE2b-256 4f39720b5d4463612a40a166d00999cbb715fce3edaf08a9a7588ba5985699ec

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1 This release

1 file

1.0

1 file

0.15

1 file

0.14

1 file

0.13

1 file

0.12

1 file

0.11

1 file

0.10

1 file

0.9

1 file

0.8

1 file

0.7

1 file

0.6

1 file

0.5

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page