exhaustion
A tiny library to help in exhaustive testing of Boolean functions in Python.
Requirements
- Python 3.6 or newer
Installation
Exhaustion can be installed using pip:
pip install exhaustion
Usage
Usage is very straightforward, exhaustion is compatible with any testing library that supports assertions.
import unittest
from exhaustion import exhaust
def _and(a: bool, b: bool):
""" A simple wrapper over the Python `and` operator for demonstration purposes.
Args:
a (bool): The left-hand operand.
b (bool): The right-hand operand.
Returns:
bool: The Boolean conjunction of the arguments provided.
"""
return a and b
class TestAndAlgebraic(unittest.TestCase):
""" Tests the algebraic properties of the _and function.
"""
def test_and_commutative(self):
""" Proves by exhaustion that the _and function is commutative.
"""
# The lambda below will execute for every possible combination of Boolean arguments.
exhaust(lambda a, b: self.assertTrue(_and(a, b) == _and(b, a)))
Related Projects
This library is intentionally very minimal, and was designed to be so. If you're looking for a richer feature set, you might consider the following projects:
- exhaust - Not to be confused with this project, a library that supports exhastive enumeration of any finite set you can express using a generator function.
License
Metadata
Release files for exhaustion 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| exhaustion-1.0.3.tar.gz | 3.3 kB | Without provenance | Details for exhaustion-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| exhaustion-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for exhaustion-1.0.3-py3-none-any.whl |
Total release size: 6.6 kB
Release files / exhaustion-1.0.3.tar.gz
| Download URL | exhaustion-1.0.3.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
984fdbc5851f2d553600497377b6c5d7abda11c2f4cd3dc7758a0133c178697a
|
|
BLAKE2b-256 checksum How to use checksums |
fd1048b2de2c5e9624f146c7bcce0a7694d737cd67fc355c6716ae4f1c1da0af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.6.9 Linux/5.4.0-124-generic
|
Release files / exhaustion-1.0.3-py3-none-any.whl
| Download URL | exhaustion-1.0.3-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1576bafad69cb183b0f634aef006969fe0b5cf7d028f8a5d1a0c2dc462479d2
|
|
BLAKE2b-256 checksum How to use checksums |
1cbe9223b8e617f32cfa9729e3c856ce24bac4bf49f3d5b6901ebc16b9e86ef4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.6.9 Linux/5.4.0-124-generic
|
Security for exhaustion 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.