mtchrs
mtchrs provides composable matchers that can be nested inside any data structure. Use them in tests where values like database IDs or UUIDs change between runs. Matchers also integrate with unittest.mock assertions such as call_args_list for verifying mock calls.
The persistent matcher mtch.eq() is especially handy for tracking values that must stay identical across nested results or several steps of a workflow.
Installation
pip install mtchrs
Example
from mtchrs import mtch
data = {"id": 1, "items": ["xyz", 1.5]}
matcher = {"id": mtch.type(int), "items": [mtch.regex(r"^x"), mtch.type(float)]}
assert matcher == data
Contributing
Pull requests are welcome! Install dependencies from the dev, lint and test groups using uv and run the linters and test suite before submitting a PR:
uv sync --all-groups
uv run pre-commit run --all-files
uv run pytest
License
This project is licensed under the MIT License.
Documentation
See the documentation for more details.
Metadata
Release files for mtchrs 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mtchrs-0.1.1.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mtchrs-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / mtchrs-0.1.1.tar.gz
| Download URL | mtchrs-0.1.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de368c2d8c48ce498d3ac1cc4ff46ade0db9c4c490c7a4170f209e6c99e096ff
|
|
BLAKE2b-256 checksum How to use checksums |
be39a74d5e8c36ba0548c9335ae2756780ee95e88d125f8c910afae90ca6cff0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.
Transparency logRelease files / mtchrs-0.1.1-py3-none-any.whl
| Download URL | mtchrs-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31eec57a8390e75ba0d07a716f665e9397c2d8938c742bc9bebe3c0dc65273c9
|
|
BLAKE2b-256 checksum How to use checksums |
7edd21a9aa1cab3941e16f4e0534d9eefc6fc4e3c9d240ea9d1b40e865d12a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.
Transparency log