assertpy
Simple assertion library for unit testing in python with a fluent API
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 assertpyuv
uv add assertpypoetry
poetry add assertpyInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
suresure provides fluent, chainable assertion…
copyleft · top 15,000 on PyPI
ensureensure provides literate assertion helpers for…
permissive · top 5,000 on PyPI
surerSurer provides fluent, RSpec-inspired assertion…
permissive · top 15,000 on PyPI
types-assertpyProvides type stubs enabling static type…
permissive · top 15,000 on PyPI
PyHamcrestPyHamcrest provides a framework for writing…
permissive · top 5,000 on PyPI
assertsProvides stand-alone assertion functions for…
unclear · top 15,000 on PyPI
expectsExpects is an assertion library for TDD/BDD…
permissive · top 15,000 on PyPI
delayed-assertCollects multiple assertion failures in a test…
unclear · top 15,000 on PyPI
re-assertProvides a helper class for regex assertions…
permissive · top 15,000 on PyPI
pytest-deepassertA pytest plugin that replaces standard…
permissive · top 15,000 on PyPI