Python library for contracts testing
Project description
ycontract
Python library for contracts testing.
This library provides functions for precondition(in_contract
) and postcondition(out_contract
).
How to install
$ pip install ycontract
Example
Example files are here(test file)
Main example is
from ycontract import in_contract, out_contract
@in_contract(lambda a, b: a * b > 0)
def add(a, b, c, d=2, e=3):
return a + b + c + d + e
@out_contract(lambda res: res > 0)
def sub(a, b):
return a - b
And if you want to be disable, call
ycontract.disable_contract()
LICENSES
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
ycontract-0.2.1.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for ycontract-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f47e48cad4640d443b5ab7d3b1aadc297a8a28545531c83621c144029f5bd574 |
|
MD5 | 6bc12a38819ac0d9aa545ce0cda0dcf6 |
|
BLAKE2b-256 | 4f19b4cbf786edfeb395360800fee80ae630cf16cfe1a41674e7d0dac697f846 |