callee
Argument matchers for unittest.mock
What it is and what it does
callee is a matcher library that sits on top of unittest.mock, letting you write more expressive assertions about what arguments a mock was called with. Instead of choosing between exact equality (which makes tests brittle) or ANY wildcards (which are too loose), you can use matchers like GreaterThan(0), InstanceOf(SomeClass), or String() to assert on properties of the arguments without handcrafting call_args checks.
The library has no runtime dependencies and is pure Python. It was last released in December 2019 and is no longer actively maintained. The repository is not archived, but there have been no commits since September 2020. It targets Python 2.6 through 3.7 according to its classifiers, making it primarily useful for legacy codebases or when you are constrained to older Python versions.
Use it for:
- Write mock assertions that check argument types or ranges without over-specifying exact values.
- Reduce boilerplate in test code by replacing manual call_args inspection with readable matchers.
- Test functions that accept objects of a certain class without caring about their exact identity.
- Verify that numeric arguments fall within expected bounds or satisfy custom predicates.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides argument matchers for unittest.mock that let you assert on mock calls with fine-grained precision—matching on types, values, or custom conditions instead of exact equality or wildcards.
No, unless you are maintaining legacy code already using callee or are locked to Python 2.6–3.7. The package is abandoned and its target Python versions are out of support. Modern Python test suites should use unittest.mock's built-in features or a maintained alternative.
Install
callee on PyPI
pip
pip install calleeuv
uv add calleepoetry
poetry add calleeInstalling callee
Before you install
High install friction: the package is abandoned (last release 2019-12-24, last commit 2020-09-11) with no runtime dependencies. It targets Python 2.6 through 3.7 per classifiers, which are now well out of support. Use only if you are locked to an old Python version or an existing codebase already using it.
License in practice
BSD license (permissive) places no restrictions on use, modification, or distribution in your own code.
Quickstart
pip install callee
from callee import GreaterThan, InstanceOf, String
from unittest.mock import Mock
m = Mock()
m(42, some_obj, 'text')
m.assert_called_with(GreaterThan(0), InstanceOf(object), String())
Requires unittest.mock (built-in Python 3.3+) or the mock backport for Python 2.6–2.7.
Verify before relying
- Whether the package works reliably with modern Python versions (3.8+) despite classifiers only listing up to 3.7.
- Current state of the repository and whether it accepts patches or is truly unmaintained.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,425 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 157,059/month — #10,767 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: callee-0.3.1.tar.gz
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
mockmock provides a backport of Python's standard…
permissive · top 1,000 on PyPI
testfixturesTestfixtures provides helpers and mock objects…
permissive · top 5,000 on PyPI
anysProvides matcher objects that compare equal to…
permissive · top 5,000 on PyPI
PyHamcrestPyHamcrest provides a framework for writing…
permissive · top 5,000 on PyPI
asyncmockProvides awaitable mock objects for testing…
permissive · top 15,000 on PyPI
pytest-mockProvides a pytest fixture that wraps the mock…
permissive · top 1,000 on PyPI
flake8-mock-specA flake8 plugin that enforces the use of the…
permissive · top 15,000 on PyPI
django-mock-queriesMocks Django QuerySet operations in memory for…
permissive · top 15,000 on PyPI
stubsProvides a context-manager syntax for…
permissive · top 15,000 on PyPI
flexmockflexmock creates mock, stub, spy, and fake…
permissive · top 15,000 on PyPI