Deal - #python library for design by contract (DbC) programming.
That's nice assert statements in decorators style to validate function input, output, available operations and object state. Goal is make testing much easier and detect errors in your code that occasionally was missed in tests.
Features:
- Automatic property-based tests.
- Static analysis.
- Generators and async coroutines support.
- External validators support.
- Type-annotated and mypy-friendly.
- Specify allowed exceptions for function.
- Invariant for all actions with class instances.
- Decorators to control available resources: forbid output, network operations, raising exceptions.
- You can disable contracts on production.
https://github.com/life4/deal/
Showcase of many existing decorators:
Post #482
2.62K