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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file mtchrs-0.1.1.tar.gz.

File metadata

  • Download URL: mtchrs-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mtchrs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 de368c2d8c48ce498d3ac1cc4ff46ade0db9c4c490c7a4170f209e6c99e096ff
MD5 0ec98692a0837f5f480c26300a6f306b
BLAKE2b-256 be39a74d5e8c36ba0548c9335ae2756780ee95e88d125f8c910afae90ca6cff0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtchrs-0.1.1.tar.gz:

Publisher: publish.yml on angru/mtchrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mtchrs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mtchrs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mtchrs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31eec57a8390e75ba0d07a716f665e9397c2d8938c742bc9bebe3c0dc65273c9
MD5 551b733c81cf62230e13725efeef67d4
BLAKE2b-256 7edd21a9aa1cab3941e16f4e0534d9eefc6fc4e3c9d240ea9d1b40e865d12a75

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtchrs-0.1.1-py3-none-any.whl:

Publisher: publish.yml on angru/mtchrs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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