skillfed

assertpy

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

assertpy v1.1 885.7K downloads/30d#4,811 on PyPI528
Permissive license BSD AGING released

What it is and what it does

assertpy is a lightweight assertion library that adds a fluent, chainable API on top of Python's standard assertions for unit testing. Instead of writing flat assert statements, you chain readable method calls like .is_equal_to(), .starts_with(), and .contains() to build expressive test conditions. It has no runtime dependencies and works with test runners like pytest and Nose.

The library was last released on 2020-07-19 and is classified as Production/Stable, but the project shows signs of age—the repository has not been actively maintained, and the latest classifiers only declare support up to Python 3.8. While it remains in the top popularity tier, relying on it for new projects means accepting that bug fixes and compatibility updates are unlikely.

Use it for:

  • Writing more readable unit tests with fluent assertion chains instead of nested assert statements
  • Migrating from verbose unittest assertions to a cleaner, method-chaining style within pytest or Nose
  • Testing collections and strings with readable predicates like .contains(), .starts_with(), .is_length()
  • Building test suites where assertion readability is a priority for team maintainability

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a fluent assertion API for writing readable unit test assertions in Python, supporting method chaining for cleaner test code.

Yes, for existing projects already using it or for teams that prioritize assertion readability in test code. No, for new projects—the package is unmaintained since 2020 and shows no active development. Modern alternatives like pytest's built-in assertions or other actively maintained fluent libraries are safer choices for long-term codebases.

Install

assertpy on PyPI

pip

pip install assertpy

uv

uv add assertpy

poetry

poetry add assertpy

Installing assertpy

Before you install

High install friction due to source distribution format. Maintenance status is aging—last release was 2020-07-19, with no commits since 2025-06-15, indicating the project is no longer actively maintained despite Production/Stable classification.

License in practice

BSD permissive license means you can use, modify, and distribute the package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install assertpy

from assertpy import assert_that

def test_example():
    assert_that(1 + 2).is_equal_to(3)
    assert_that('foobar').is_length(6).starts_with('foo')

Verify before relying

  • Whether the package works reliably with modern Python versions beyond 3.8, given the last release was in 2020
  • Current status of the conda-forge feedstock and whether conda installation remains viable
  • Active maintenance status given the repository shows no recent commits despite being marked Production/Stable

Package facts

License BSD (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance aging — 2,217 days since the last release
Last repo commit
First released
Downloads 885,666/month — #4,811 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: assertpy-1.1.tar.gz

Keywords: test, testing, assert, assertion, assertthat, assert_that, nose, nosetests, pytest, unittest

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software DevelopmentTopic :: Software Development :: Testing

Tags

fluent assertions testingunit test assertion libraryreadable test assertions pythonassert_that fluent apipytest assertion helperstest framework assertions
testingunmaintainedfluent-api

More Software Development packages