Skip to main content

No project description provided

Project description

mtchrs

build codecov

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mtchrs-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mtchrs-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for mtchrs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 98a09c34abdd194e7e9d8b89f2a3ecdc81d557ce74c8a06dfd747fbc9e8d1608
MD5 77c707b8a70c3053299693aaa67e4f6f
BLAKE2b-256 48b2fcfde7ae1c5a17a48be4b15addb3af7960f5bf4524586650a7587a672c6c

See more details on using hashes here.

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

Hashes for mtchrs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e274d9247eee83066823aaff2a2ebbc7a929bf40b04ea657610d39cb1bd08e39
MD5 aa1a1d7c45897d8de11baac1632d5588
BLAKE2b-256 6f8f19a3d5e3190a841b0adc0b7ed61e9e3edd32aacd2df6597cebce15a5d29c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page