No project description provided
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mtchrs-0.1.0.tar.gz.
File metadata
- Download URL: mtchrs-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a09c34abdd194e7e9d8b89f2a3ecdc81d557ce74c8a06dfd747fbc9e8d1608
|
|
| MD5 |
77c707b8a70c3053299693aaa67e4f6f
|
|
| BLAKE2b-256 |
48b2fcfde7ae1c5a17a48be4b15addb3af7960f5bf4524586650a7587a672c6c
|
File details
Details for the file mtchrs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mtchrs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e274d9247eee83066823aaff2a2ebbc7a929bf40b04ea657610d39cb1bd08e39
|
|
| MD5 |
aa1a1d7c45897d8de11baac1632d5588
|
|
| BLAKE2b-256 |
6f8f19a3d5e3190a841b0adc0b7ed61e9e3edd32aacd2df6597cebce15a5d29c
|