Skip to main content

pytest-probatio

Use a probatio schema as a pytest assertion matcher. A schema reads as the expected shape, and a mismatch is explained by probatio's path-precise errors instead of a bare assert.

from pytest_probatio import Exact, Partial
from probatio import Port


def test_response(response):
    # Exact: extra keys make it unequal.
    assert response == Exact({"name": str, "port": Port()})

    # Partial: extra keys are allowed.
    assert response == Partial({"name": str})
    assert Exact({"name": str}) <= response

When the data does not match, the failure lists each error by its path:

data does not match the probatio schema (==):
  data['port']: expected a port number between 1 and 65535

Install it alongside pytest; the plugin registers itself:

pip install pytest-probatio

This package lives in the probatio monorepo but ships separately, so the core probatio library stays dependency-free.

Download files

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

Source Distribution

pytest_probatio-0.5.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

pytest_probatio-0.5.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest_probatio-0.5.3.tar.gz.

File metadata

  • Download URL: pytest_probatio-0.5.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pytest_probatio-0.5.3.tar.gz
Algorithm Hash digest
SHA256 dec3e86224b0ee11439b12492be8f9918fe36365e7e7cd9b9d49773d690f55f2
MD5 cf7e250cd5d0aeacb0c3be2b9a077d98
BLAKE2b-256 6b833123aa0928f7705f77bd21bb051a663f6227589b141113815d1139adc826

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_probatio-0.5.3.tar.gz:

Publisher: release.yaml on frenck/probatio

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

File details

Details for the file pytest_probatio-0.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_probatio-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31cb4384188798854712407188c51dd236a3c11c26673423700276019f6e6e2b
MD5 d338f07e2e38cb38a197b7c796dd34e9
BLAKE2b-256 9417c58391f1875183cfa5a52b36b29a72ef279daf46e84810b2ce9c9eefbaf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_probatio-0.5.3-py3-none-any.whl:

Publisher: release.yaml on frenck/probatio

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 Sentry Error logging StatusPage Status page