Use a probatio schema as a pytest assertion matcher
Project description
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.
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 pytest_probatio-0.3.0.tar.gz.
File metadata
- Download URL: pytest_probatio-0.3.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8df9d397c8c23553bd381b037f966db225feb79eb70d07c9b4d1c78515d725e4
|
|
| MD5 |
4c5e834413d1af1af090d157749146bb
|
|
| BLAKE2b-256 |
2b599ce0ff60ff7a23b390b9488b1d8666f1ff38a189ce8f24f34b5ae0e99d41
|
Provenance
The following attestation bundles were made for pytest_probatio-0.3.0.tar.gz:
Publisher:
release.yaml on frenck/probatio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_probatio-0.3.0.tar.gz -
Subject digest:
8df9d397c8c23553bd381b037f966db225feb79eb70d07c9b4d1c78515d725e4 - Sigstore transparency entry: 1994331601
- Sigstore integration time:
-
Permalink:
frenck/probatio@0a4c0bcd47bc398efd3dbd0fcb6288bf5702ec86 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/frenck
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@0a4c0bcd47bc398efd3dbd0fcb6288bf5702ec86 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_probatio-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pytest_probatio-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82b933b4d6bc0f8c18eb6f0dbace9d4321ef3c2a8d2f69c19a355d62b5bd7ae9
|
|
| MD5 |
b91c3cad00733faf289924f8b33471ec
|
|
| BLAKE2b-256 |
6a0b7fe23e507864c459d5da103be846e6b3ea28724a3732b3810a62bd843a5d
|
Provenance
The following attestation bundles were made for pytest_probatio-0.3.0-py3-none-any.whl:
Publisher:
release.yaml on frenck/probatio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_probatio-0.3.0-py3-none-any.whl -
Subject digest:
82b933b4d6bc0f8c18eb6f0dbace9d4321ef3c2a8d2f69c19a355d62b5bd7ae9 - Sigstore transparency entry: 1994332113
- Sigstore integration time:
-
Permalink:
frenck/probatio@0a4c0bcd47bc398efd3dbd0fcb6288bf5702ec86 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/frenck
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@0a4c0bcd47bc398efd3dbd0fcb6288bf5702ec86 -
Trigger Event:
release
-
Statement type: