A small assertion library for testing
Project description
Assertive
Assertive is a lightweight Python assertion library for writing declarative, composable test expectations.
Install
pip install assertive
Quickstart
from assertive import (
contains,
is_even,
is_gt,
is_lt,
regex,
)
assert 5 == is_gt(4)
assert 5 == is_gt(4) & is_lt(6)
assert 4 == is_even()
assert "hello" == regex(r"^h.*o$")
assert [1, 2, 3] == contains(2)
You can compose criteria with boolean operators:
assert 5 == is_gt(4) & is_lt(6) # AND
assert 5 == is_even() | is_lt(6) # OR
assert 5 == is_even() ^ is_lt(6) # XOR
assert 5 == ~is_even() # NOT
Documentation
- User guide: https://peter-daly.github.io/assertive/
- Criteria reference: https://peter-daly.github.io/assertive/criteria/
- Writing custom criteria: https://peter-daly.github.io/assertive/criteria/writing-custom-criteria/
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
assertive-1.3.0.tar.gz
(11.6 kB
view details)
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
assertive-1.3.0-py3-none-any.whl
(15.6 kB
view details)
File details
Details for the file assertive-1.3.0.tar.gz.
File metadata
- Download URL: assertive-1.3.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7237069632ddf5628111683c6cc5e81599a70d993c0db1cf6962e7fe5c26c371
|
|
| MD5 |
1e2058547df4f965a0f005adecd90732
|
|
| BLAKE2b-256 |
bd7dfc86496f8bd0a5a5b1fed520903502fc89b4f17d5018a332db13f7b87408
|
File details
Details for the file assertive-1.3.0-py3-none-any.whl.
File metadata
- Download URL: assertive-1.3.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc87b00fb63bc5a258d7c9aa25f0485ba743c4345303cb3fa5b6288a43e75609
|
|
| MD5 |
cfec322b81993f3faf3c73c20b3a1449
|
|
| BLAKE2b-256 |
2c2729d12dba21de5a0efa4c368eeba2f9abf0017491913196929d55c18a19d0
|