Metadata-Version: 2.4
Name: assertive
Version: 1.3.0
Summary: A small assertion library for testing
Project-URL: Homepage, https://github.com/peter-daly/assertive
Project-URL: Repository, https://github.com/peter-daly/assertive
Project-URL: Documentation, https://peter-daly.github.io/assertive/
Author: Peter Daly
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.10
Requires-Dist: bidict<0.24,>=0.23.1
Description-Content-Type: text/markdown

# Assertive

Assertive is a lightweight Python assertion library for writing declarative, composable test expectations.

## Install

```bash
pip install assertive
```

## Quickstart

```python
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:

```python
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/>
